OSDN Git Service

SDK Updater: Minor change to make composite constructor compliant with
authorRaphael <raphael@google.com>
Mon, 1 Jun 2009 22:21:22 +0000 (15:21 -0700)
committerRaphael <raphael@google.com>
Mon, 1 Jun 2009 22:21:22 +0000 (15:21 -0700)
SWT designer.

All custom params should be last. SWT Designer expects the first
arg to be the parent composite.

tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RemotePackagesPage.java
tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl.java

index 7a8c62c..1fe5ca4 100755 (executable)
@@ -74,16 +74,16 @@ public class RemotePackagesPage extends Composite {
     private Label mDescriptionLabel;\r
 \r
 \r
-\r
     /**\r
      * Create the composite.\r
      * @param parent The parent of the composite.\r
      * @param updaterData An instance of {@link UpdaterData}. If null, a local\r
      *        one will be allocated just to help with the SWT Designer.\r
+     * @param updaterWindow The parent window.\r
      */\r
-    public RemotePackagesPage(UpdaterWindowImpl updaterWindow,\r
-            Composite parent,\r
-            UpdaterData updaterData) {\r
+    RemotePackagesPage(Composite parent,\r
+            UpdaterData updaterData,\r
+            UpdaterWindowImpl updaterWindow) {\r
         super(parent, SWT.BORDER);\r
         mUpdaterWindow = updaterWindow;\r
 \r
@@ -161,11 +161,23 @@ public class RemotePackagesPage extends Composite {
     // Hide everything down-below from SWT designer\r
     //$hide>>$\r
 \r
+    /**\r
+     * Must be called once to set the adapter input for the sources tree viewer.\r
+     */\r
+    public void setInput(RepoSourcesAdapter sources) {\r
+        mTreeViewerSources.setContentProvider(sources.getContentProvider());\r
+        mTreeViewerSources.setLabelProvider(  sources.getLabelProvider());\r
+        mTreeViewerSources.setInput(sources);\r
+        onTreeSelected();\r
+    }\r
+\r
+    /**\r
+     * Called by the constructor right after {@link #createContents(Composite)}.\r
+     */\r
     private void postCreate() {\r
         adjustColumnsWidth();\r
     }\r
 \r
-\r
     /**\r
      * Adds a listener to adjust the columns width when the parent is resized.\r
      * <p/>\r
@@ -183,13 +195,12 @@ public class RemotePackagesPage extends Composite {
         });\r
     }\r
 \r
-    public void setInput(RepoSourcesAdapter sources) {\r
-        mTreeViewerSources.setContentProvider(sources.getContentProvider());\r
-        mTreeViewerSources.setLabelProvider(  sources.getLabelProvider());\r
-        mTreeViewerSources.setInput(sources);\r
-        onTreeSelected();\r
-    }\r
-\r
+    /**\r
+     * Called when an item in the package table viewer is selected.\r
+     * If the items is an {@link IDescription} (as it should), this will display its long\r
+     * description in the description area. Otherwise when the item is not of the expected\r
+     * type or there is no selection, it empties the description area.\r
+     */\r
     private void onTreeSelected() {\r
         ISelection sel = mTreeViewerSources.getSelection();\r
         if (sel instanceof ITreeSelection) {\r
index 5613bfd..2a3ff90 100755 (executable)
@@ -129,7 +129,7 @@ public class UpdaterWindowImpl {
         mPagesRootComposite.setLayout(mStackLayout);\r
 \r
         mLocalPackagePage = new LocalPackagesPage(mPagesRootComposite, mUpdaterData);\r
-        mRemotePackagesPage = new RemotePackagesPage(this, mPagesRootComposite, mUpdaterData);\r
+        mRemotePackagesPage = new RemotePackagesPage(mPagesRootComposite, mUpdaterData, this);\r
         mSashForm.setWeights(new int[] {150, 576});\r
     }\r
 \r