OSDN Git Service

am f1d64e29: Fix the sdk/scritps/create_*_symlinks for the new SDK git project.
authorRaphael <raphael@google.com>
Thu, 19 Nov 2009 01:12:02 +0000 (17:12 -0800)
committerAndroid Git Automerger <android-git-automerger@android.com>
Thu, 19 Nov 2009 01:12:02 +0000 (17:12 -0800)
Merge commit 'f1d64e2975451e3bbbcd2e62a03a717308db500a' into eclair

* commit 'f1d64e2975451e3bbbcd2e62a03a717308db500a':
  Fix the sdk/scritps/create_*_symlinks for the new SDK git project.

37 files changed:
eclipse/features/com.android.ide.eclipse.adt/feature.xml
eclipse/features/com.android.ide.eclipse.ddms/feature.xml
eclipse/features/com.android.ide.eclipse.tests/feature.xml
eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/ActivityLaunchAction.java
eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
eclipse/plugins/com.android.ide.eclipse.tests/build.properties
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtSdkTestCase.java [deleted file]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkEnvTestCase.java [deleted file]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
eclipse/plugins/com.android.ide.eclipse.tests/test.xml
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/project/AndroidManifestParserTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/AndroidJarLoaderTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/LayoutParamsParserTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/AndroidManifest-instrumentation.xml [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/AndroidManifest-instrumentation.xml with 100% similarity]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/AndroidManifest-testapp.xml [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/AndroidManifest-testapp.xml with 100% similarity]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/jar_example.jar [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/jar_example.jar with 100% similarity]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/jar_example.jardesc [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/jar_example.jardesc with 100% similarity]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/mock_attrs.xml [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/mock_attrs.xml with 100% similarity]
eclipse/scripts/create_test_symlinks.sh
eclipse/sites/external/site.xml
eclipse/sites/internal/site.xml
scripts/doc_source.properties
scripts/platform_source.properties
scripts/tools_source.properties
scripts/usbdriver_source.properties
sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-2.xsd [new file with mode: 0755]
sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RemotePackagesPage.java
sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdateChooserDialog.java
sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java

index e4cc9f2..f1d3e73 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="com.android.ide.eclipse.adt"
       label="Android Development Tools"
-      version="0.9.4.qualifier"
+      version="0.9.5.qualifier"
       provider-name="The Android Open Source Project"
       plugin="com.android.ide.eclipse.adt">
 
index 9b782ac..455acc5 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="com.android.ide.eclipse.ddms"
       label="Android DDMS"
-      version="0.9.4.qualifier"
+      version="0.9.5.qualifier"
       provider-name="The Android Open Source Project">
 
    <description>
index 679da31..75abcd4 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="com.android.ide.eclipse.tests"
       label="ADT Tests"
-      version="0.9.4.qualifier"
+      version="0.9.5.qualifier"
       provider-name="The Android Open Source Project">
 
    <copyright>
index 0c78390..24fbc56 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Android Development Toolkit
 Bundle-SymbolicName: com.android.ide.eclipse.adt;singleton:=true
-Bundle-Version: 0.9.4.qualifier
+Bundle-Version: 0.9.5.qualifier
 Bundle-ClassPath: .,
  jarutils.jar,
  androidprefs.jar,
index b6f9a09..1178449 100644 (file)
@@ -628,10 +628,7 @@ public class ConfigurationComposite extends Composite {
             }
 
             mDeviceConfigs.select(0);
-            if (configNames.size() == 1) {
-                mDeviceConfigs.setEnabled(false);
-            }
-
+            mDeviceConfigs.setEnabled(configNames.size() > 1);
         }
         if (recomputeLayout) {
             onDeviceConfigChange();
index 09f01ec..d1502d3 100644 (file)
@@ -28,10 +28,10 @@ public class ActivityLaunchAction implements IAndroidLaunchAction {
 
     private final String mActivity;
     private final ILaunchController mLaunchController;
-    
+
     /**
      * Creates a ActivityLaunchAction
-     * 
+     *
      * @param activity fully qualified activity name to launch
      * @param controller the {@link ILaunchController} that performs launch
      */
@@ -39,13 +39,13 @@ public class ActivityLaunchAction implements IAndroidLaunchAction {
         mActivity = activity;
         mLaunchController = controller;
     }
-    
+
     /**
      * Launches the activity on targeted device
-     * 
+     *
      * @param info the {@link DelayedLaunchInfo} that contains launch details
      * @param device the Android device to perform action on
-     * 
+     *
      * @see IAndroidLaunchAction#doLaunchAction(DelayedLaunchInfo, IDevice)
      */
     public boolean doLaunchAction(DelayedLaunchInfo info, IDevice device) {
@@ -65,7 +65,9 @@ public class ActivityLaunchAction implements IAndroidLaunchAction {
                             : "") //$NON-NLS-1$
                     + " -n " //$NON-NLS-1$
                     + info.getPackageName() + "/" //$NON-NLS-1$
-                    + mActivity.replaceAll("\\$", "\\\\\\$"), //$NON-NLS-1$ //$NON-NLS-2$
+                    + mActivity.replaceAll("\\$", "\\\\\\$") //$NON-NLS-1$ //$NON-NLS-2$
+                    + " -a android.intent.action.MAIN"  //$NON-NLS-1$
+                    + " -c android.intent.category.LAUNCHER",  //$NON-NLS-1$
                     new AMReceiver(info, device, mLaunchController));
 
             // if the app is not a debug app, we need to do some clean up, as
@@ -84,14 +86,14 @@ public class ActivityLaunchAction implements IAndroidLaunchAction {
         }
         return true;
     }
-    
+
     /**
      * Returns a description of the activity being launched
-     * 
+     *
      * @see IAndroidLaunchAction#getLaunchDescription()
      */
     public String getLaunchDescription() {
        return String.format("%1$s activity launch", mActivity);
     }
-    
+
 }
index 3d70ec0..ee93981 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Dalvik Debug Monitor Service
 Bundle-SymbolicName: com.android.ide.eclipse.ddms;singleton:=true
-Bundle-Version: 0.9.4.qualifier
+Bundle-Version: 0.9.5.qualifier
 Bundle-Activator: com.android.ide.eclipse.ddms.DdmsPlugin
 Bundle-Vendor: The Android Open Source Project
 Bundle-Localization: plugin
index 0497d2c..fac3e99 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Android Plugin Tests
 Bundle-SymbolicName: com.android.ide.eclipse.tests
-Bundle-Version: 0.9.4.qualifier
+Bundle-Version: 0.9.5.qualifier
 Bundle-Activator: com.android.ide.eclipse.tests.AndroidTestPlugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
index 290cad7..a97e147 100644 (file)
@@ -7,9 +7,10 @@ bin.includes = META-INF/,\
                prefs.template,\
                unittest.xml,\
                kxml2-2.3.0.jar,\
-               unittests/data/,\
                sdklib.jar,\
                layoutlib_api.jar,\
                layoutlib.jar,\
                unittests/com/android/sdklib/testdata/,\
-               unittests/com/android/layoutlib/testdata/
+               unittests/com/android/layoutlib/testdata/,\
+               unittests/com/android/ide/eclipse/testdata/
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtSdkTestCase.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtSdkTestCase.java
deleted file mode 100644 (file)
index d884f35..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- *      http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.tests;
-
-import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
-import com.android.ide.eclipse.adt.internal.sdk.Sdk;
-
-/**
- * A test case which uses the Sdk loaded by the Adt plugin.
- */
-public abstract class AdtSdkTestCase extends SdkTestCase {
-
-    protected AdtSdkTestCase() {
-    }
-
-    /**
-     * Gets the current Sdk from Adt, waiting if necessary.
-     */
-    @Override
-    protected Sdk loadSdk() {
-        AdtPlugin adt = AdtPlugin.getDefault();
-        Object sdkLock = adt.getSdkLockObject();
-        LoadStatus loadStatus = LoadStatus.LOADING;
-        // wait for Adt to load the Sdk on a separate thread
-        // loop max of 600 times * 200 ms =  2 minutes
-        final int maxWait = 600;
-        for (int i=0; i < maxWait && loadStatus == LoadStatus.LOADING; i++) {
-            try {
-                Thread.sleep(200);
-            }
-            catch (InterruptedException e) {
-                // ignore
-            }
-            synchronized(sdkLock) {
-                loadStatus = adt.getSdkLoadStatus();
-            }
-        }
-        Sdk sdk = null;
-        synchronized(sdkLock) {
-            assertEquals(LoadStatus.LOADED, loadStatus);
-            sdk = Sdk.getCurrent();
-        }
-        assertNotNull(sdk);
-        return sdk;
-    }
-}
index 6d13737..281170e 100644 (file)
@@ -1,12 +1,12 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
- * 
+ *
  * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
  * may not use this file except in compliance with the License. You may obtain a
  * copy of the License at
- * 
+ *
  * http://www.eclipse.org/org/documents/epl-v10.php
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -27,57 +27,53 @@ import java.util.logging.Logger;
 
 /**
  * Helper class for retrieving test data
- * 
- * All tests which need to retrieve test data files should go through this class 
- *
+ * <p/>
+ * All tests which need to retrieve paths to test data files should go through this class.
  */
 public class AdtTestData {
 
     /** singleton instance */
     private static AdtTestData sInstance = null;
     private static final Logger sLogger = Logger.getLogger(AdtTestData.class.getName());
-    
-    /** the absolute file path to the /data directory in this test 
-     * environment. 
-     */
+
+    /** The absolute file path to the plugin's contents. */
     private String mOsRootDataPath;
-    
-   
+
     private AdtTestData() {
-        // can set test_data env variable to override default behavior of 
+        // can set test_data env variable to override default behavior of
         // finding data using class loader
-        // useful when running in plugin environment, where test data is inside 
-        // bundled jar, and must be extracted to temp filesystem location to be 
+        // useful when running in plugin environment, where test data is inside
+        // bundled jar, and must be extracted to temp filesystem location to be
         // accessed normally
         mOsRootDataPath = System.getProperty("test_data");
         if (mOsRootDataPath == null) {
             sLogger.info("Cannot find test_data environment variable, init to class loader");
-            URL url = this.getClass().getClassLoader().getResource("data");  //$NON-NLS-1$
+            URL url = this.getClass().getClassLoader().getResource(".");  //$NON-NLS-1$
 
-                if (Platform.isRunning()) {
-                    sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
-                    try {
-                        mOsRootDataPath = FileLocator.resolve(url).getFile();
-                    } catch (IOException e) {
-                        sLogger.warning("IOException while using FileLocator, reverting to url");
-                        mOsRootDataPath = url.getFile();
-                    }
-                } else {
-                    sLogger.info("Running as an plain JUnit test, using url as-is");
-                    mOsRootDataPath = url.getFile();                        
+            if (Platform.isRunning()) {
+                sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
+                try {
+                    mOsRootDataPath = FileLocator.resolve(url).getFile();
+                } catch (IOException e) {
+                    sLogger.warning("IOException while using FileLocator, reverting to url");
+                    mOsRootDataPath = url.getFile();
                 }
+            } else {
+                sLogger.info("Running as an plain JUnit test, using url as-is");
+                mOsRootDataPath = url.getFile();
+            }
         }
-        
-        if (mOsRootDataPath.equals(AndroidConstants.WS_SEP + "data")) {
+
+        if (mOsRootDataPath.equals(AndroidConstants.WS_SEP)) {
             sLogger.warning("Resource data not found using class loader!, Defaulting to no path");
         }
-        
+
         if (!mOsRootDataPath.endsWith(File.separator)) {
             sLogger.info("Fixing test_data env variable (does not end with path separator)");
             mOsRootDataPath = mOsRootDataPath.concat(File.separator);
         }
     }
-    
+
     /** Get the singleton instance of AdtTestData */
     public static AdtTestData getInstance() {
         if (sInstance == null) {
@@ -85,12 +81,14 @@ public class AdtTestData {
         }
         return sInstance;
     }
-    
-    /** Returns the absolute file path to a file located in this plugins
-     * "data" directory
-     * @param osRelativePath - string path to file contained in /data. Must 
+
+    /**
+     * Returns the absolute file path to a file located in this plugin.
+     *
+     * @param osRelativePath {@link String} path to file contained in plugin. Must
      * use path separators appropriate to host OS
-     * @return String
+     *
+     * @return absolute OS path to test file
      */
     public String getTestFilePath(String osRelativePath) {
         return mOsRootDataPath + osRelativePath;
index 02c9247..efa8801 100644 (file)
@@ -16,7 +16,6 @@
 package com.android.ide.eclipse.tests;
 
 import com.android.ide.eclipse.tests.functests.layoutRendering.ApiDemosRenderingTest;
-import com.android.ide.eclipse.tests.functests.sampleProjects.SampleProjectTest;
 
 import junit.framework.TestSuite;
 
@@ -39,7 +38,8 @@ public class FuncTests extends TestSuite {
     public static TestSuite suite() {
         TestSuite suite = new TestSuite();
 
-        suite.addTestSuite(SampleProjectTest.class);
+        // TODO: uncomment this when 'gen' folder error on create is fixed
+        // suite.addTestSuite(SampleProjectTest.class);
         suite.addTestSuite(ApiDemosRenderingTest.class);
 
         return suite;
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkEnvTestCase.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkEnvTestCase.java
deleted file mode 100644 (file)
index 1039a7f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.tests;
-
-import com.android.ide.eclipse.adt.internal.sdk.Sdk;
-
-
-/**
- * A test case that receives a specific Sdk to test via the "sdk_home" environment variable.
- */
-public abstract class SdkEnvTestCase extends SdkTestCase {
-
-    protected SdkEnvTestCase() {
-    }
-
-    /**
-     * Loads the {@link Sdk}.
-     * <p/>
-     * Fails test if environment variable "sdk_home" is not set.
-     */
-    @Override
-    protected Sdk loadSdk() {
-        String osSdkLocation = System.getProperty("sdk_home");
-        if (osSdkLocation == null) {
-            osSdkLocation = System.getenv("sdk_home");
-        }
-        if (osSdkLocation == null || osSdkLocation.length() < 1) {
-            fail("Environment variable sdk_home is not set");
-        }
-        return Sdk.loadSdk(osSdkLocation);
-    }
-}
index 322ce3e..7f2eef6 100644 (file)
@@ -15,7 +15,9 @@
  */
 package com.android.ide.eclipse.tests;
 
+import com.android.ide.eclipse.adt.AdtPlugin;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
+import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.sdklib.IAndroidTarget;
 
@@ -25,7 +27,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
 import junit.framework.TestCase;
 
 /**
- * A test case that needs a reference to a SDK.
+ * A test case which uses the SDK loaded by the ADT plugin.
  */
 public abstract class SdkTestCase extends TestCase {
 
@@ -47,9 +49,34 @@ public abstract class SdkTestCase extends TestCase {
     }
 
     /**
-     * Loads the {@link Sdk} to use for test
+     * Gets the current SDK from ADT, waiting if necessary.
      */
-    protected abstract Sdk loadSdk();
+    private Sdk loadSdk() {
+        AdtPlugin adt = AdtPlugin.getDefault();
+        Object sdkLock = adt.getSdkLockObject();
+        LoadStatus loadStatus = LoadStatus.LOADING;
+        // wait for ADT to load the SDK on a separate thread
+        // loop max of 600 times * 200 ms =  2 minutes
+        final int maxWait = 600;
+        for (int i=0; i < maxWait && loadStatus == LoadStatus.LOADING; i++) {
+            try {
+                Thread.sleep(200);
+            }
+            catch (InterruptedException e) {
+                // ignore
+            }
+            synchronized(sdkLock) {
+                loadStatus = adt.getSdkLoadStatus();
+            }
+        }
+        Sdk sdk = null;
+        synchronized(sdkLock) {
+            assertEquals(LoadStatus.LOADED, loadStatus);
+            sdk = Sdk.getCurrent();
+        }
+        assertNotNull(sdk);
+        return sdk;
+    }
 
     /**
      * Checks that the provided sdk contains one or more valid targets.
index 3b52789..1bbce87 100644 (file)
@@ -39,7 +39,7 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
 import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData.LayoutBridge;
-import com.android.ide.eclipse.tests.SdkEnvTestCase;
+import com.android.ide.eclipse.tests.SdkTestCase;
 import com.android.layoutlib.api.ILayoutResult;
 import com.android.layoutlib.api.IProjectCallback;
 import com.android.layoutlib.api.IResourceValue;
@@ -59,7 +59,7 @@ import java.util.Map;
 
 import javax.imageio.ImageIO;
 
-public class ApiDemosRenderingTest extends SdkEnvTestCase {
+public class ApiDemosRenderingTest extends SdkTestCase {
 
     /**
      * Custom parser that implements {@link IXmlPullParser} (which itself extends
index 89421ef..d33b939 100644 (file)
@@ -17,7 +17,7 @@ package com.android.ide.eclipse.tests.functests.sampleProjects;
 
 import com.android.ide.eclipse.adt.AndroidConstants;
 import com.android.ide.eclipse.adt.wizards.newproject.StubProjectWizard;
-import com.android.ide.eclipse.tests.AdtSdkTestCase;
+import com.android.ide.eclipse.tests.SdkTestCase;
 import com.android.sdklib.IAndroidTarget;
 
 import org.eclipse.core.resources.IMarker;
@@ -44,7 +44,7 @@ import java.util.logging.Logger;
  * execution there
  *
  */
-public class SampleProjectTest extends AdtSdkTestCase {
+public class SampleProjectTest extends SdkTestCase {
 
     private static final Logger sLogger = Logger.getLogger(SampleProjectTest.class.getName());
 
index 7fd3b0d..e5519b0 100644 (file)
@@ -54,7 +54,7 @@
             <property name="plugin-name" value="${plugin-name}" />
             <property name="classname" value="com.android.ide.eclipse.tests.AllTests" />
             <!-- pass extra vm arg to set sdk_home env and test_data env variable -->
-            <property name="extraVMargs" value="-Dsdk_home=${sdk_home} -Dtest_data=${test_data}" />
+            <property name="extraVMargs" value="-Dtest_data=${test_data}" />
         </ant>
     </target>
 
index b76e802..e05391c 100644 (file)
@@ -28,9 +28,13 @@ import junit.framework.TestCase;
 public class AndroidManifestParserTest extends TestCase {
     private AndroidManifestParser mManifestTestApp;
     private AndroidManifestParser mManifestInstrumentation;
-    
-    private static final String INSTRUMENTATION_XML = "AndroidManifest-instrumentation.xml";  //$NON-NLS-1$
-    private static final String TESTAPP_XML = "AndroidManifest-testapp.xml";  //$NON-NLS-1$
+
+    private static final String TESTDATA_PATH =
+        "com/android/ide/eclipse/testdata/";  //$NON-NLS-1$
+    private static final String INSTRUMENTATION_XML = TESTDATA_PATH +
+        "AndroidManifest-instrumentation.xml";  //$NON-NLS-1$
+    private static final String TESTAPP_XML = TESTDATA_PATH +
+        "AndroidManifest-testapp.xml";  //$NON-NLS-1$
     private static final String PACKAGE_NAME =  "com.android.testapp"; //$NON-NLS-1$
     private static final String ACTIVITY_NAME = "com.android.testapp.MainActivity"; //$NON-NLS-1$
     private static final String LIBRARY_NAME = "android.test.runner"; //$NON-NLS-1$
@@ -40,26 +44,24 @@ public class AndroidManifestParserTest extends TestCase {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        
-        String testFilePath = AdtTestData.getInstance().getTestFilePath(
-                TESTAPP_XML);
+
+        String testFilePath = AdtTestData.getInstance().getTestFilePath(TESTAPP_XML);
         mManifestTestApp = AndroidManifestParser.parseForData(testFilePath);
         assertNotNull(mManifestTestApp);
-        
-        testFilePath = AdtTestData.getInstance().getTestFilePath(
-                INSTRUMENTATION_XML);
+
+        testFilePath = AdtTestData.getInstance().getTestFilePath(INSTRUMENTATION_XML);
         mManifestInstrumentation = AndroidManifestParser.parseForData(testFilePath);
         assertNotNull(mManifestInstrumentation);
     }
 
     public void testGetInstrumentationInformation() {
         assertEquals(1, mManifestInstrumentation.getInstrumentations().length);
-        assertEquals(INSTRUMENTATION_NAME, 
+        assertEquals(INSTRUMENTATION_NAME,
                 mManifestInstrumentation.getInstrumentations()[0].getName());
-        assertEquals(INSTRUMENTATION_TARGET, 
+        assertEquals(INSTRUMENTATION_TARGET,
                 mManifestInstrumentation.getInstrumentations()[0].getTargetPackage());
     }
-    
+
     public void testGetPackage() {
         assertEquals(PACKAGE_NAME, mManifestTestApp.getPackage());
     }
@@ -80,7 +82,7 @@ public class AndroidManifestParserTest extends TestCase {
         assertTrue(activity.hasAction());
         assertTrue(activity.isHomeActivity());
     }
-    
+
     private void assertEquals(Activity lhs, Activity rhs) {
         assertTrue(lhs == rhs || (lhs != null && rhs != null));
         if (lhs != null && rhs != null) {
@@ -93,7 +95,7 @@ public class AndroidManifestParserTest extends TestCase {
 
     public void testGetUsesLibraries() {
         assertEquals(1, mManifestTestApp.getUsesLibraries().length);
-        assertEquals(LIBRARY_NAME, mManifestTestApp.getUsesLibraries()[0]); 
+        assertEquals(LIBRARY_NAME, mManifestTestApp.getUsesLibraries()[0]);
     }
 
     public void testGetPackageName() {
index ac6ebf5..f5c16e7 100644 (file)
@@ -17,9 +17,6 @@
 package com.android.ide.eclipse.adt.internal.resources;
 
 
-import com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser;
-import com.android.ide.eclipse.adt.internal.resources.DeclareStyleableInfo;
-import com.android.ide.eclipse.adt.internal.resources.ViewClassInfo;
 import com.android.ide.eclipse.adt.internal.resources.DeclareStyleableInfo.AttributeInfo;
 import com.android.ide.eclipse.adt.internal.resources.DeclareStyleableInfo.AttributeInfo.Format;
 import com.android.ide.eclipse.tests.AdtTestData;
@@ -32,20 +29,23 @@ import java.util.Map;
 import junit.framework.TestCase;
 
 public class AttrsXmlParserTest extends TestCase {
-    
+
     private AttrsXmlParser mParser;
     private String mFilePath;
 
+    private static final String MOCK_DATA_PATH =
+        "com/android/ide/eclipse/testdata/mock_attrs.xml"; //$NON-NLS-1$
+
     @Override
     public void setUp() throws Exception {
-        mFilePath = AdtTestData.getInstance().getTestFilePath("mock_attrs.xml"); //$NON-NLS-1$
+        mFilePath = AdtTestData.getInstance().getTestFilePath(MOCK_DATA_PATH); //$NON-NLS-1$
         mParser = new AttrsXmlParser(mFilePath);
     }
 
     @Override
     public void tearDown() throws Exception {
     }
-    
+
     public final void testGetDocument() throws Exception {
         assertNotNull(_getDocument());
     }
@@ -53,12 +53,12 @@ public class AttrsXmlParserTest extends TestCase {
     public void testGetOsAttrsXmlPath() throws Exception {
         assertEquals(mFilePath, mParser.getOsAttrsXmlPath());
     }
-    
+
     public final void testPreload() throws Exception {
         assertSame(mParser, mParser.preload());
     }
-    
-    
+
+
     public final void testLoadViewAttributes() throws Exception {
         mParser.preload();
         ViewClassInfo info = new ViewClassInfo(
@@ -66,7 +66,7 @@ public class AttrsXmlParserTest extends TestCase {
                 "mock_android.something.Theme",      //$NON-NLS-1$
                 "Theme");                            //$NON-NLS-1$
         mParser.loadViewAttributes(info);
-        
+
         assertEquals("These are the standard attributes that make up a complete theme.", //$NON-NLS-1$
                 info.getJavaDoc());
         AttributeInfo[] attrs = info.getAttributes();
@@ -75,7 +75,7 @@ public class AttrsXmlParserTest extends TestCase {
         assertEquals(1, info.getAttributes()[0].getFormats().length);
         assertEquals(Format.DIMENSION, info.getAttributes()[0].getFormats()[0]);
     }
-    
+
     public final void testEnumFlagValues() throws Exception {
         /* The XML being read contains:
             <!-- Standard orientation constant. -->
@@ -90,32 +90,32 @@ public class AttrsXmlParserTest extends TestCase {
         mParser.preload();
         Map<String, Map<String, Integer>> attrMap = mParser.getEnumFlagValues();
         assertTrue(attrMap.containsKey("orientation"));
-        
+
         Map<String, Integer> valueMap = attrMap.get("orientation");
         assertTrue(valueMap.containsKey("horizontal"));
         assertTrue(valueMap.containsKey("vertical"));
         assertEquals(Integer.valueOf(0), valueMap.get("horizontal"));
         assertEquals(Integer.valueOf(1), valueMap.get("vertical"));
     }
-    
+
     public final void testDeprecated() throws Exception {
         mParser.preload();
-        
+
         DeclareStyleableInfo dep = mParser.getDeclareStyleableList().get("DeprecatedTest");
         assertNotNull(dep);
-        
+
         AttributeInfo[] attrs = dep.getAttributes();
         assertEquals(4, attrs.length);
 
         assertEquals("deprecated-inline", attrs[0].getName());
         assertEquals("In-line deprecated.", attrs[0].getDeprecatedDoc());
         assertEquals("Deprecated comments using delimiters.", attrs[0].getJavaDoc());
-        
+
         assertEquals("deprecated-multiline", attrs[1].getName());
         assertEquals("Multi-line version of deprecated that works till the next tag.",
                 attrs[1].getDeprecatedDoc());
         assertEquals("Deprecated comments on their own line.", attrs[1].getJavaDoc());
-        
+
         assertEquals("deprecated-not", attrs[2].getName());
         assertEquals(null, attrs[2].getDeprecatedDoc());
         assertEquals("This attribute is not deprecated.", attrs[2].getJavaDoc());
@@ -126,7 +126,7 @@ public class AttrsXmlParserTest extends TestCase {
     }
 
     //---- access to private methods
-    
+
     private Document _getDocument() throws Exception {
         Method method = AttrsXmlParser.class.getDeclaredMethod("getDocument"); //$NON-NLS-1$
         method.setAccessible(true);
index 71c79be..f9178f1 100644 (file)
@@ -40,7 +40,8 @@ public class AndroidJarLoaderTest extends TestCase {
     /** Creates an instance of {@link AndroidJarLoader} on our test data JAR */ 
     @Override
     public void setUp() throws Exception {
-        String jarfilePath = AdtTestData.getInstance().getTestFilePath("jar_example.jar");  //$NON-NLS-1$
+        String jarfilePath = AdtTestData.getInstance().getTestFilePath(
+                "com/android/ide/eclipse/testdata/jar_example.jar");  //$NON-NLS-1$
         mFrameworkClassLoader = new AndroidJarLoader(jarfilePath);
     }
 
index cf5f194..166b63d 100644 (file)
@@ -19,15 +19,12 @@ package com.android.ide.eclipse.adt.internal.sdk;
 import com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser;
 import com.android.ide.eclipse.adt.internal.resources.ViewClassInfo;
 import com.android.ide.eclipse.adt.internal.resources.ViewClassInfo.LayoutParamsInfo;
-import com.android.ide.eclipse.adt.internal.sdk.AndroidJarLoader;
-import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
-import com.android.ide.eclipse.adt.internal.sdk.LayoutParamsParser;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidJarLoader.ClassWrapper;
 import com.android.ide.eclipse.adt.internal.sdk.IAndroidClassLoader.IClassDescriptor;
+import com.android.ide.eclipse.tests.AdtTestData;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.TreeMap;
@@ -36,7 +33,7 @@ import junit.framework.TestCase;
 
 /**
  * Test the inner private methods of PlatformDataParser.
- * 
+ *
  * Convention: method names that start with an underscore are actually local wrappers
  * that call private methods from {@link AndroidTargetParser} using reflection.
  * This is inspired by the Python coding rule which mandates underscores prefixes for
@@ -44,30 +41,26 @@ import junit.framework.TestCase;
  */
 public class LayoutParamsParserTest extends TestCase {
 
+    private static final String MOCK_DATA_PATH =
+        "com/android/ide/eclipse/testdata/mock_attrs.xml"; //$NON-NLS-1$
+
     private static class MockFrameworkClassLoader extends AndroidJarLoader {
         MockFrameworkClassLoader() {
             super(null /* osFrameworkLocation */);
         }
-        
+
         @Override
         public HashMap<String, ArrayList<IClassDescriptor>> findClassesDerivingFrom(
                 String rootPackage, String[] superClasses) throws ClassFormatError {
             return new HashMap<String, ArrayList<IClassDescriptor>>();
         }
     }
-    
-    private static class MockAttrsXmlPath {
-        public String getPath() {
-            ClassLoader cl = this.getClass().getClassLoader();
-            URL res = cl.getResource("data/mock_attrs.xml");  //$NON-NLS-1$
-            return res.getFile();
-        }
-    }
-    
+
     private static class MockLayoutParamsParser extends LayoutParamsParser {
         public MockLayoutParamsParser() {
             super(new MockFrameworkClassLoader(),
-                  new AttrsXmlParser(new MockAttrsXmlPath().getPath()).preload());
+                  new AttrsXmlParser(
+                          AdtTestData.getInstance().getTestFilePath(MOCK_DATA_PATH)).preload());
 
             mTopViewClass = new ClassWrapper(mock_android.view.View.class);
             mTopGroupClass = new ClassWrapper(mock_android.view.ViewGroup.class);
@@ -82,7 +75,7 @@ public class LayoutParamsParserTest extends TestCase {
     }
 
     private MockLayoutParamsParser mParser;
-    
+
     @Override
     public void setUp() throws Exception {
         mParser = new MockLayoutParamsParser();
@@ -91,7 +84,7 @@ public class LayoutParamsParserTest extends TestCase {
     @Override
     public void tearDown() throws Exception {
     }
-    
+
     public final void testFindLayoutParams() throws Exception {
         assertEquals(mock_android.view.ViewGroup.LayoutParams.class,
             ((ClassWrapper)_findLayoutParams(mock_android.view.ViewGroup.class)).wrappedClass());
@@ -102,7 +95,7 @@ public class LayoutParamsParserTest extends TestCase {
         assertEquals(mock_android.widget.TableLayout.LayoutParams.class,
             ((ClassWrapper)_findLayoutParams(mock_android.widget.TableLayout.class)).wrappedClass());
     }
-    
+
     public final void testGetLayoutParamsInfo() throws Exception {
         LayoutParamsInfo info1 = _getLayoutParamsInfo(
                 mock_android.view.ViewGroup.LayoutParams.class);
@@ -115,7 +108,7 @@ public class LayoutParamsParserTest extends TestCase {
         assertNotNull(info2);
         // LinearLayout.LayoutData links to ViewGroup.LayoutParams
         assertSame(info1, info2.getSuperClass());
-        
+
         LayoutParamsInfo info3 = _getLayoutParamsInfo(
                 mock_android.widget.TableLayout.LayoutParams.class);
         assertNotNull(info3);
@@ -124,7 +117,7 @@ public class LayoutParamsParserTest extends TestCase {
         assertNotSame(info1, info3.getSuperClass());
         assertNotSame(info2, info3.getSuperClass());
         // TableLayout.LayoutParams => ViewGroup.MarginLayoutParams => ViewGroup.LayoutParams
-        assertSame(info1, info3.getSuperClass().getSuperClass());        
+        assertSame(info1, info3.getSuperClass().getSuperClass());
     }
 
     public final void testGetLayoutClasses() throws Exception {
@@ -132,7 +125,7 @@ public class LayoutParamsParserTest extends TestCase {
     }
 
     //---- access to private methods
-    
+
     /** Calls the private constructor of the parser */
     @SuppressWarnings("unused")
     private AndroidTargetParser _Constructor(String osJarPath) throws Exception {
@@ -141,7 +134,7 @@ public class LayoutParamsParserTest extends TestCase {
         constructor.setAccessible(true);
         return constructor.newInstance(osJarPath);
     }
-    
+
     /** calls the private getLayoutClasses() of the parser */
     @SuppressWarnings("unused")
     private void _getLayoutClasses() throws Exception {
@@ -149,7 +142,7 @@ public class LayoutParamsParserTest extends TestCase {
         method.setAccessible(true);
         method.invoke(mParser);
     }
-    
+
     /** calls the private addGroup() of the parser */
     @SuppressWarnings("unused")
     private ViewClassInfo _addGroup(Class<?> groupClass) throws Exception {
@@ -175,7 +168,7 @@ public class LayoutParamsParserTest extends TestCase {
         method.setAccessible(true);
         return (LayoutParamsInfo) method.invoke(mParser, new ClassWrapper(layoutParamsClass));
     }
-    
+
     /** calls the private findLayoutParams() of the parser */
     private IClassDescriptor _findLayoutParams(Class<?> groupClass) throws Exception {
         Method method = LayoutParamsParser.class.getDeclaredMethod("findLayoutParams",  //$NON-NLS-1$
index a7a3599..b5505d0 100755 (executable)
@@ -69,8 +69,10 @@ DEST=$BASE/unittests/com/android
 cpdir $DEST sdk/ddms/libs/ddmlib/tests/src/com/android/ddmlib
 cpdir $DEST sdk/sdkmanager/libs/sdklib/tests/com/android/sdklib
 
+# Cleanup old obsolete symlink
+[[ -e $DEST/sdkuilib || -L $DEST/sdkuilib ]] && rm -rfv $DEST/sdkuilib
+
 DEST=$BASE/unittests/com/android/layoutlib
 mkdir -p $DEST
 cpdir $DEST frameworks/base/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge
 cpdir $DEST frameworks/base/tools/layoutlib/bridge/tests/com/android/layoutlib/testdata
-
index ef0df64..5956c3d 100644 (file)
@@ -3,10 +3,10 @@
    <description url="https://dl-ssl.google.com/android/eclipse/">
       Update Site for Android Development Toolkit
    </description>
-   <feature url="features/com.android.ide.eclipse.adt_0.9.4.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.4.qualifier">
+   <feature url="features/com.android.ide.eclipse.adt_0.9.5.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
-   <feature url="features/com.android.ide.eclipse.ddms_0.9.4.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.4.qualifier">
+   <feature url="features/com.android.ide.eclipse.ddms_0.9.5.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
    <category-def name="developer" label="Developer Tools">
index 31744d7..3c71c10 100644 (file)
@@ -3,13 +3,13 @@
    <description url="https://android.corp.google.com/adt/">
       Update Site for Android Development Toolkit
    </description>
-   <feature url="features/com.android.ide.eclipse.adt_0.9.4.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.4.qualifier">
+   <feature url="features/com.android.ide.eclipse.adt_0.9.5.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
-   <feature url="features/com.android.ide.eclipse.ddms_0.9.4.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.4.qualifier">
+   <feature url="features/com.android.ide.eclipse.ddms_0.9.5.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
-   <feature url="features/com.android.ide.eclipse.tests_0.9.4.qualifier.jar" id="com.android.ide.eclipse.tests" version="0.9.4.qualifier">
+   <feature url="features/com.android.ide.eclipse.tests_0.9.5.qualifier.jar" id="com.android.ide.eclipse.tests" version="0.9.5.qualifier">
       <category name="test"/>
    </feature>
    <category-def name="developer" label="Application Developer Tools">
index fab394a..0536fbe 100644 (file)
@@ -1,5 +1,5 @@
 Pkg.UserSrc=false
-Platform.Version=2.0
+Platform.Version=2.0.1
 Pkg.Revision=1
-AndroidVersion.ApiLevel=5
+AndroidVersion.ApiLevel=6
 
index 01f7807..5fb6fec 100644 (file)
@@ -1,5 +1,5 @@
-Pkg.Desc=Android SDK Platform 2.0_r1
+Pkg.Desc=Android SDK Platform 2.0.1_r1
 Pkg.UserSrc=false
-Platform.Version=2.0
+Platform.Version=2.0.1
 Pkg.Revision=1
-AndroidVersion.ApiLevel=5
+AndroidVersion.ApiLevel=6
index b75e326..f8de7ce 100644 (file)
@@ -1,2 +1,2 @@
 Pkg.UserSrc=false
-Pkg.Revision=4
+Pkg.Revision=5
index 9db3852..1984dca 100755 (executable)
@@ -1,4 +1,4 @@
-Pkg.Revision=1\r
+Pkg.Revision=2\r
 Archive.Os=WINDOWS\r
 Archive.Arch=ANY\r
 Extra.Path=usb_driver\r
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-2.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-2.xsd
new file mode 100755 (executable)
index 0000000..79b7628
--- /dev/null
@@ -0,0 +1,405 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<xsd:schema
+    targetNamespace="http://schemas.android.com/sdk/android/repository/2"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:sr2="http://schemas.android.com/sdk/android/repository/2"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    version="1">
+
+    <!-- The repository contains a collection of downloadable items known as
+         "packages". Each package has a type and various attributes and contains
+         a list of file "archives" that can be downloaded for specific OSes.
+
+         An Android SDK repository is a web site that contains a "repository.xml"
+         file that conforms to this XML Schema.
+    -->
+
+    <xsd:element name="sdk-repository" type="sr2:repositoryType" />
+
+    <xsd:complexType name="repositoryType">
+        <xsd:annotation>
+            <xsd:documentation>
+                The repository contains collections of downloadable packages.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element name="platform" type="sr2:platformType" />
+            <xsd:element name="add-on"   type="sr2:addonType"    />
+            <xsd:element name="tool"     type="sr2:toolType"     />
+            <xsd:element name="doc"      type="sr2:docType"      />
+            <xsd:element name="extra"    type="sr2:extraType"    />
+            <xsd:element name="sample"   type="sr2:sampleType"   />
+            <xsd:element name="license"  type="sr2:licenseType"  />
+        </xsd:choice>
+    </xsd:complexType>
+
+    <!-- The definition of an SDK platform package. -->
+
+    <xsd:complexType name="platformType">
+        <xsd:annotation>
+            <xsd:documentation>An SDK platform package.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:all>
+            <!-- The Android platform version. It is string such as "1.0". -->
+            <xsd:element name="version"   type="xsd:normalizedString" />
+            <!-- The Android API Level for the platform. An int > 0. -->
+            <xsd:element name="api-level" type="xsd:positiveInteger"  />
+            <!-- The optional codename for this platform, if it's a preview. -->
+            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
+
+            <!-- The revision, an int > 0, incremented each time a new
+                 package is generated. -->
+            <xsd:element name="revision"     type="xsd:positiveInteger" />
+            <!-- The optional license of this package. If present, users will have
+                 to agree to it before downloading. -->
+            <xsd:element name="uses-license" type="sr2:usesLicenseType" minOccurs="0" />
+            <!-- The optional description of this package. -->
+            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
+            <!-- The optional description URL of this package -->
+            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
+            <!-- The optional release note for this package. -->
+            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
+            <!-- The optional release note URL of this package -->
+            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
+            <!-- A list of file archives for this package. -->
+            <xsd:element name="archives"     type="sr2:archivesType" />
+            <!-- The minimal revision of tools required by this package.
+                 Optional. If present, must be an int > 0. -->
+            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
+        </xsd:all>
+    </xsd:complexType>
+
+
+    <!-- The definition of an SDK Add-on package. -->
+
+    <xsd:complexType name="addonType">
+        <xsd:annotation>
+            <xsd:documentation>An SDK add-on package.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:all>
+            <!-- The name of the add-on. -->
+            <xsd:element name="name"      type="xsd:normalizedString" />
+            <!-- The vendor of the add-on. -->
+            <xsd:element name="vendor"    type="xsd:normalizedString" />
+            <!-- The Android API Level for the add-on. An int > 0. -->
+            <xsd:element name="api-level" type="xsd:positiveInteger"  />
+            <!-- The optional codename for this add-on, if it's a preview. -->
+            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
+
+            <!-- The revision, an int > 0, incremented each time a new
+                 package is generated. -->
+            <xsd:element name="revision"     type="xsd:positiveInteger" />
+            <!-- The optional license of this package. If present, users will have
+                 to agree to it before downloading. -->
+            <xsd:element name="uses-license" type="sr2:usesLicenseType" minOccurs="0" />
+            <!-- The optional description of this package. -->
+            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
+            <!-- The optional description URL of this package -->
+            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
+            <!-- The optional release note for this package. -->
+            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
+            <!-- The optional release note URL of this package -->
+            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
+            <!-- A list of file archives for this package. -->
+            <xsd:element name="archives"     type="sr2:archivesType" />
+
+            <!-- An add-on can declare 0 or more libraries. -->
+
+            <xsd:element name="libs">
+                <xsd:complexType>
+                    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+                        <xsd:element name="lib">
+                            <xsd:complexType>
+                                <xsd:all>
+                                    <!-- The name of the library. -->
+                                    <xsd:element name="name" type="xsd:normalizedString" />
+                                    <!-- The optional description of this add-on library. -->
+                                    <xsd:element name="description" type="xsd:string" minOccurs="0" />
+                                </xsd:all>
+                            </xsd:complexType>
+                        </xsd:element>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:all>
+    </xsd:complexType>
+
+
+    <!-- The definition of an SDK tool package. -->
+
+    <xsd:complexType name="toolType" >
+        <xsd:annotation>
+            <xsd:documentation>An SDK tool package.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:all>
+            <!-- The revision, an int > 0, incremented each time a new
+                 package is generated. -->
+            <xsd:element name="revision"     type="xsd:positiveInteger" />
+            <!-- The optional license of this package. If present, users will have
+                 to agree to it before downloading. -->
+            <xsd:element name="uses-license" type="sr2:usesLicenseType" minOccurs="0" />
+            <!-- The optional description of this package. -->
+            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
+            <!-- The optional description URL of this package -->
+            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
+            <!-- The optional release note for this package. -->
+            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
+            <!-- The optional release note URL of this package -->
+            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
+            <!-- A list of file archives for this package. -->
+            <xsd:element name="archives"     type="sr2:archivesType" />
+        </xsd:all>
+    </xsd:complexType>
+
+
+    <!-- The definition of an SDK doc package. -->
+
+    <xsd:complexType name="docType" >
+        <xsd:annotation>
+            <xsd:documentation>An SDK doc package.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:all>
+            <!-- The Android API Level for the documentation. An int > 0. -->
+            <xsd:element name="api-level" type="xsd:positiveInteger"  />
+            <!-- The optional codename for this doc, if it's a preview. -->
+            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
+
+            <!-- The revision, an int > 0, incremented each time a new
+                 package is generated. -->
+            <xsd:element name="revision"     type="xsd:positiveInteger" />
+            <!-- The optional license of this package. If present, users will have
+                 to agree to it before downloading. -->
+            <xsd:element name="uses-license" type="sr2:usesLicenseType" minOccurs="0" />
+            <!-- The optional description of this package. -->
+            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
+            <!-- The optional description URL of this package -->
+            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
+            <!-- The optional release note for this package. -->
+            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
+            <!-- The optional release note URL of this package -->
+            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
+            <!-- A list of file archives for this package. -->
+            <xsd:element name="archives"     type="sr2:archivesType" />
+        </xsd:all>
+    </xsd:complexType>
+
+
+    <!-- The definition of an SDK extra package. This kind of package is for
+         "free" content and specifies in which fixed root directory it must be
+         installed.
+    -->
+
+    <xsd:complexType name="extraType" >
+        <xsd:annotation>
+            <xsd:documentation>
+                An SDK extra package. This kind of package is for "free"
+                content and specifies in which fixed root directory it must be
+                installed.
+                The paths "add-ons", "platforms", "tools" and "docs" are
+                reserved and cannot be used.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:all>
+            <!-- The install folder name. It must be a single-segment path.
+                 The paths "add-ons", "platforms", "tools" and "docs" are
+                 reserved and cannot be used.
+            -->
+            <xsd:element name="path">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:pattern value="[^/\\]+"/>
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <!-- The revision, an int > 0, incremented each time a new
+                 package is generated. -->
+            <xsd:element name="revision"     type="xsd:positiveInteger" />
+            <!-- The optional license of this package. If present, users will have
+                 to agree to it before downloading. -->
+            <xsd:element name="uses-license" type="sr2:usesLicenseType" minOccurs="0" />
+            <!-- The optional description of this package. -->
+            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
+            <!-- The optional description URL of this package -->
+            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
+            <!-- The optional release note for this package. -->
+            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
+            <!-- The optional release note URL of this package -->
+            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
+            <!-- A list of file archives for this package. -->
+            <xsd:element name="archives"     type="sr2:archivesType" />
+            <!-- The minimal revision of tools required by this package.
+                 Optional. If present, must be an int > 0. -->
+            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
+        </xsd:all>
+    </xsd:complexType>
+
+
+    <!-- The definition of a sample package. -->
+
+    <xsd:complexType name="sampleType">
+        <xsd:annotation>
+            <xsd:documentation>
+                An SDK sample package.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:all>
+            <!-- The Android API Level for the sample. An int > 0. -->
+            <xsd:element name="api-level" type="xsd:positiveInteger"  />
+            <!-- The optional codename for this sample, if the platform is a preview. -->
+            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
+
+            <!-- The revision, an int > 0, incremented each time a new
+                 package is generated. -->
+            <xsd:element name="revision"     type="xsd:positiveInteger" />
+            <!-- The optional license of this package. If present, users will have
+                 to agree to it before downloading. -->
+            <xsd:element name="uses-license" type="sr2:usesLicenseType" minOccurs="0" />
+            <!-- The optional description of this package. -->
+            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
+            <!-- The optional description URL of this package -->
+            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
+            <!-- The optional release note for this package. -->
+            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
+            <!-- The optional release note URL of this package -->
+            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
+            <!-- A list of file archives for this package. -->
+            <xsd:element name="archives"     type="sr2:archivesType" />
+        </xsd:all>
+    </xsd:complexType>
+
+
+    <!-- The definition of a license to be referenced by the uses-license element. -->
+
+    <xsd:complexType name="licenseType">
+        <xsd:annotation>
+            <xsd:documentation>
+                A license definition. Such a license must be used later as a reference
+                using a uses-license element in one of the package elements.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="id"   type="xsd:ID" />
+                <xsd:attribute name="type" type="xsd:token" fixed="text" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <!-- Type describing the license used by a package.
+         The license MUST be defined using a license node and referenced
+         using the ref attribute of the license element inside a package.
+     -->
+
+    <xsd:complexType name="usesLicenseType">
+        <xsd:annotation>
+            <xsd:documentation>
+                Describes the license used by a package. The license MUST be defined
+                using a license node and referenced using the ref attribute of the
+                license element inside a package.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:attribute name="ref" type="xsd:IDREF" />
+    </xsd:complexType>
+
+
+    <!-- A collection of files that can be downloaded for a given architecture.
+         The <archives> node is mandatory in the repository elements and the
+         collection must have at least one <archive> declared.
+         Each archive is a zip file that will be unzipped in a location that depends
+         on its package type.
+     -->
+
+    <xsd:complexType name="archivesType">
+        <xsd:annotation>
+            <xsd:documentation>
+                A collection of files that can be downloaded for a given architecture.
+                The &lt;archives&gt; node is mandatory in the repository packages and the
+                collection must have at least one &lt;archive&gt; declared.
+                Each archive is a zip file that will be unzipped in a location that depends
+                on its package type.
+            </xsd:documentation>
+        </xsd:annotation>
+        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
+            <!-- One archive file -->
+            <xsd:element name="archive">
+                <xsd:complexType>
+                    <!-- Properties of the archive file -->
+                    <xsd:all>
+                        <!-- The size in bytes of the archive to download. -->
+                        <xsd:element name="size"     type="xsd:positiveInteger" />
+                        <!-- The checksum of the archive file. -->
+                        <xsd:element name="checksum" type="sr2:checksumType" />
+                        <!-- The URL is an absolute URL if it starts with http://, https://
+                             or ftp://. Otherwise it is relative to the parent directory that
+                             contains this repository.xml -->
+                        <xsd:element name="url"      type="xsd:token" />
+                    </xsd:all>
+
+                    <!-- Attributes that identify the OS and architecture -->
+                    <xsd:attribute name="os" use="required">
+                        <xsd:simpleType>
+                            <xsd:restriction base="xsd:token">
+                                <xsd:enumeration value="any" />
+                                <xsd:enumeration value="linux" />
+                                <xsd:enumeration value="macosx" />
+                                <xsd:enumeration value="windows" />
+                            </xsd:restriction>
+                        </xsd:simpleType>
+                    </xsd:attribute>
+                    <xsd:attribute name="arch" use="optional">
+                        <xsd:simpleType>
+                            <xsd:restriction base="xsd:token">
+                                <xsd:enumeration value="any" />
+                                <xsd:enumeration value="ppc" />
+                                <xsd:enumeration value="x86" />
+                                <xsd:enumeration value="x86_64" />
+                            </xsd:restriction>
+                        </xsd:simpleType>
+                    </xsd:attribute>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+    </xsd:complexType>
+
+
+    <!-- The definition of a file checksum -->
+
+    <xsd:simpleType name="sha1Number">
+        <xsd:annotation>
+            <xsd:documentation>A SHA1 checksum.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:restriction base="xsd:string">
+            <xsd:pattern value="([0-9a-fA-F]){40}"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <xsd:complexType name="checksumType">
+        <xsd:annotation>
+            <xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:simpleContent>
+            <xsd:extension base="sr2:sha1Number">
+                <xsd:attribute name="type" type="xsd:token" fixed="sha1" />
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+
+</xsd:schema>
index 8757e66..861389f 100755 (executable)
@@ -283,7 +283,32 @@ public class RemotePackagesPage extends Composite implements ISdkListener {
         SettingsController controller = mUpdaterData.getSettingsController();\r
         controller.setShowUpdateOnly(mUpdateOnlyCheckBox.getSelection());\r
         controller.saveSettings();\r
+\r
+        // Get the list of selected archives\r
+        ArrayList<Archive> archives = new ArrayList<Archive>();\r
+        for (Object element : mTreeViewerSources.getCheckedElements()) {\r
+            if (element instanceof Archive) {\r
+                archives.add((Archive) element);\r
+            }\r
+            // Deselect them all\r
+            mTreeViewerSources.setChecked(element, false);\r
+        }\r
+\r
         mTreeViewerSources.refresh();\r
+\r
+        // Now reselect those that still exist in the tree but only if they\r
+        // are compatible archives\r
+        for (Archive a : archives) {\r
+            if (a.isCompatible() && mTreeViewerSources.setChecked(a, true)) {\r
+                // If we managed to select the archive, also select the parent package.\r
+                // Technically we should only select the parent package if *all* the\r
+                // compatible archives children are selected. In practice we'll rarely\r
+                // have more than one compatible archive per package.\r
+                mTreeViewerSources.setChecked(a.getParentPackage(), true);\r
+            }\r
+        }\r
+\r
+        updateButtonsState();\r
     }\r
 \r
     private void onInstallSelectedArchives() {\r
index 11919a0..6a139de 100755 (executable)
@@ -22,13 +22,16 @@ import com.android.sdklib.internal.repository.Archive;
 import com.android.sdklib.internal.repository.IPackageVersion;\r
 import com.android.sdklib.internal.repository.Package;\r
 import com.android.sdkuilib.internal.repository.icons.ImageFactory;\r
+import com.android.sdkuilib.ui.GridDialog;\r
 \r
+import org.eclipse.jface.dialogs.IDialogConstants;\r
 import org.eclipse.jface.viewers.ISelection;\r
 import org.eclipse.jface.viewers.IStructuredContentProvider;\r
 import org.eclipse.jface.viewers.IStructuredSelection;\r
 import org.eclipse.jface.viewers.LabelProvider;\r
 import org.eclipse.jface.viewers.TableViewer;\r
 import org.eclipse.jface.viewers.Viewer;\r
+import org.eclipse.jface.window.Window;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.custom.SashForm;\r
 import org.eclipse.swt.custom.StyleRange;\r
@@ -37,8 +40,6 @@ import org.eclipse.swt.events.ControlAdapter;
 import org.eclipse.swt.events.ControlEvent;\r
 import org.eclipse.swt.events.SelectionAdapter;\r
 import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.events.ShellAdapter;\r
-import org.eclipse.swt.events.ShellEvent;\r
 import org.eclipse.swt.graphics.Image;\r
 import org.eclipse.swt.graphics.Point;\r
 import org.eclipse.swt.graphics.Rectangle;\r
@@ -46,8 +47,7 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;\r
 import org.eclipse.swt.widgets.Button;\r
 import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Dialog;\r
-import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Control;\r
 import org.eclipse.swt.widgets.Group;\r
 import org.eclipse.swt.widgets.Label;\r
 import org.eclipse.swt.widgets.Shell;\r
@@ -60,25 +60,16 @@ import java.util.ArrayList;
 /**\r
  * Implements an {@link UpdateChooserDialog}.\r
  */\r
-final class UpdateChooserDialog extends Dialog {\r
-\r
-    /** Min Y location for dialog. Need to deal with the menu bar on mac os. */\r
-    private final static int MIN_Y =\r
-        SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN ? 20 : 0;\r
+final class UpdateChooserDialog extends GridDialog {\r
 \r
     /** Last dialog size for this session. */\r
     private static Point sLastSize;\r
-    private boolean mCancelled = true;\r
-    private boolean mCompleted;\r
     private boolean mLicenseAcceptAll;\r
     private boolean mInternalLicenseRadioUpdate;\r
 \r
     // UI fields\r
-    private Shell mDialogShell;\r
     private SashForm mSashForm;\r
     private Composite mPackageRootComposite;\r
-    private Button mCancelButton;\r
-    private Button mInstallButton;\r
     private TableViewer mTableViewPackage;\r
     private Table mTablePackage;\r
     private TableColumn mTableColum;\r
@@ -114,12 +105,16 @@ final class UpdateChooserDialog extends Dialog {
     public UpdateChooserDialog(Shell parentShell,\r
             UpdaterData updaterData,\r
             ArrayList<ArchiveInfo> archives) {\r
-        super(parentShell,\r
-              SWT.APPLICATION_MODAL);\r
+        super(parentShell, 3, false/*makeColumnsEqual*/);\r
         mUpdaterData = updaterData;\r
         mArchives = archives;\r
     }\r
 \r
+    @Override\r
+    protected boolean isResizable() {\r
+        return true;\r
+    }\r
+\r
     /**\r
      * Returns the results, i.e. the list of selected new archives to install.\r
      * This is similar to the {@link ArchiveInfo} list instance given to the constructor\r
@@ -130,7 +125,7 @@ final class UpdateChooserDialog extends Dialog {
     public ArrayList<ArchiveInfo> getResult() {\r
         ArrayList<ArchiveInfo> ais = new ArrayList<ArchiveInfo>();\r
 \r
-        if (!mCancelled) {\r
+        if (getReturnCode() == Window.OK) {\r
             for (ArchiveInfo ai : mArchives) {\r
                 if (ai.isAccepted()) {\r
                     ais.add(ai);\r
@@ -142,45 +137,13 @@ final class UpdateChooserDialog extends Dialog {
     }\r
 \r
     /**\r
-     * Open the dialog and blocks till it gets closed\r
-     */\r
-    public void open() {\r
-        createContents();\r
-        positionShell();            //$hide$ (hide from SWT designer)\r
-        mDialogShell.open();\r
-        mDialogShell.layout();\r
-\r
-        postCreate();               //$hide$ (hide from SWT designer)\r
-\r
-        Display display = getParent().getDisplay();\r
-        while (!mDialogShell.isDisposed() && !mCompleted) {\r
-            if (!display.readAndDispatch()) {\r
-                display.sleep();\r
-            }\r
-        }\r
-\r
-        if (!mDialogShell.isDisposed()) {\r
-            mDialogShell.close();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Create contents of the dialog.\r
+     * Create the main content of the dialog.\r
+     * See also {@link #createButtonBar(Composite)} below.\r
      */\r
-    private void createContents() {\r
-        mDialogShell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);\r
-        mDialogShell.addShellListener(new ShellAdapter() {\r
-            @Override\r
-            public void shellClosed(ShellEvent e) {\r
-                onShellClosed(e);\r
-            }\r
-        });\r
-        mDialogShell.setLayout(new GridLayout(3, false/*makeColumnsEqual*/));\r
-        mDialogShell.setSize(600, 400);\r
-        mDialogShell.setText("Choose Packages to Install");\r
-\r
+    @Override\r
+    public void createDialogContent(Composite parent) {\r
         // Sash form\r
-        mSashForm = new SashForm(mDialogShell, SWT.NONE);\r
+        mSashForm = new SashForm(parent, SWT.NONE);\r
         mSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));\r
 \r
 \r
@@ -223,7 +186,7 @@ final class UpdateChooserDialog extends Dialog {
 \r
         mPackageText = new StyledText(mPackageTextGroup,\r                        SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);\r
         mPackageText.setBackground(\r
-                getParent().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));\r
+                getParentShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));\r
         mPackageText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));\r
 \r
         mLicenseRadioAccept = new Button(mPackageRootComposite, SWT.RADIO);\r
@@ -257,58 +220,67 @@ final class UpdateChooserDialog extends Dialog {
         });\r
 \r
         mSashForm.setWeights(new int[] {200, 300});\r
+    }\r
 \r
-        // Error message area\r
+    /**\r
+     * Creates and returns the contents of this dialog's button bar.\r
+     * <p/>\r
+     * This reimplements most of the code from the base class with a few exceptions:\r
+     * <ul>\r
+     * <li>Enforces 3 columns.\r
+     * <li>Inserts a full-width error label.\r
+     * <li>Inserts a help label on the left of the first button.\r
+     * <li>Renames the OK button into "Install"\r
+     * </ul>\r
+     */\r
+    @Override\r
+    protected Control createButtonBar(Composite parent) {\r
+\r
+        Composite composite = new Composite(parent, SWT.NONE);\r
+        GridLayout layout = new GridLayout();\r
+        layout.numColumns = 0; // this is incremented by createButton\r
+        layout.makeColumnsEqualWidth = false;\r
+        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);\r
+        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);\r
+        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);\r
+        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);\r
+        composite.setLayout(layout);\r
+        GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);\r
+        composite.setLayoutData(data);\r
+        composite.setFont(parent.getFont());\r
 \r
-        mErrorLabel = new Label(mDialogShell, SWT.NONE);\r
+        // Error message area\r
+        mErrorLabel = new Label(composite, SWT.NONE);\r
         mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));\r
 \r
+        // Label at the left of the install/cancel buttons\r
+        Label label = new Label(composite, SWT.NONE);\r
+        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));\r
+        label.setText("[*] Something depends on this package");\r
+        label.setEnabled(false);\r
+        layout.numColumns++;\r
 \r
-        // Bottom buttons area\r
+        // Add the ok/cancel to the button bar.\r
+        createButtonsForButtonBar(composite);\r
 \r
-        placeholder = new Label(mDialogShell, SWT.NONE);\r
-        placeholder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));\r
-        placeholder.setText("[*] Something depends on this package");\r
-        placeholder.setEnabled(false);\r
+        // the ok button should be an "install" button\r
+        Button button = getButton(IDialogConstants.OK_ID);\r
+        button.setText("Install");\r
 \r
-        // for MacOS, the Cancel button should be left.\r
-        if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_DARWIN) {\r
-            mCancelButton = new Button(mDialogShell, SWT.PUSH);\r
-        }\r
-\r
-        mInstallButton = new Button(mDialogShell, SWT.PUSH);\r
-        mInstallButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));\r
-        mInstallButton.setText("Install Accepted");\r
-        mInstallButton.addSelectionListener(new SelectionAdapter() {\r
-            @Override\r
-            public void widgetSelected(SelectionEvent e) {\r
-                onInstallSelected();\r
-            }\r
-        });\r
-\r
-        // if we haven't created the cancel button yet (macos?), create it now.\r
-        if (mCancelButton == null) {\r
-            mCancelButton = new Button(mDialogShell, SWT.PUSH);\r
-        }\r
-        mCancelButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));\r
-        mCancelButton.setText("Cancel");\r
-        mCancelButton.addSelectionListener(new SelectionAdapter() {\r
-            @Override\r
-            public void widgetSelected(SelectionEvent e) {\r
-                onCancelSelected();\r
-            }\r
-        });\r
+        return composite;\r
     }\r
 \r
     // -- End of UI, Start of internal logic ----------\r
     // Hide everything down-below from SWT designer\r
     //$hide>>$\r
 \r
-    /**\r
-     * Starts the thread that runs the task.\r
-     * This is deferred till the UI is created.\r
-     */\r
-    private void postCreate() {\r
+    @Override\r
+    public void create() {\r
+        super.create();\r
+\r
+        // set window title\r
+        getShell().setText("Choose Packages to Install");\r
+\r
         setWindowImage();\r
 \r
         // Automatically accept those with an empty license or no license\r
@@ -344,7 +316,7 @@ final class UpdateChooserDialog extends Dialog {
         if (mUpdaterData != null) {\r
             ImageFactory imgFactory = mUpdaterData.getImageFactory();\r
             if (imgFactory != null) {\r
-                mDialogShell.setImage(imgFactory.getImageByName(imageName));\r
+                getShell().setImage(imgFactory.getImageByName(imageName));\r
             }\r
         }\r
     }\r
@@ -369,69 +341,33 @@ final class UpdateChooserDialog extends Dialog {
     }\r
 \r
     /**\r
-     * Callback invoked when the shell is closed either by clicking the close button\r
-     * on by calling shell.close().\r
      * Captures the window size before closing this.\r
+     * @see #getInitialSize()\r
      */\r
-    private void onShellClosed(ShellEvent e) {\r
-        sLastSize = mDialogShell.getSize();\r
+    @Override\r
+    public boolean close() {\r
+        sLastSize = getShell().getSize();\r
+        return super.close();\r
     }\r
 \r
     /**\r
-     * Centers the dialog in its parent shell.\r
+     * Tries to reuse the last window size during this session.\r
+     * <p/>\r
+     * Note: the alternative would be to implement {@link #getDialogBoundsSettings()}\r
+     * since the default {@link #getDialogBoundsStrategy()} is to persist both location\r
+     * and size.\r
      */\r
-    private void positionShell() {\r
-        // Centers the dialog in its parent shell\r
-        Shell child = mDialogShell;\r
-        Shell parent = getParent();\r
-        if (child != null && parent != null) {\r
-\r
-            // get the parent client area with a location relative to the display\r
-            Rectangle parentArea = parent.getClientArea();\r
-            Point parentLoc = parent.getLocation();\r
-            int px = parentLoc.x;\r
-            int py = parentLoc.y;\r
-            int pw = parentArea.width;\r
-            int ph = parentArea.height;\r
-\r
-            // Reuse the last size if there's one, otherwise use the default\r
-            Point childSize = sLastSize != null ? sLastSize : child.getSize();\r
-            int cw = childSize.x;\r
-            int ch = childSize.y;\r
-\r
-            int x = px + (pw - cw) / 2;\r
-            int y = py + (ph - ch) / 2;\r
-\r
-            if (x < 0) {\r
-                x = 0;\r
-            }\r
-\r
-            if (y < MIN_Y) {\r
-                y = MIN_Y;\r
-            }\r
-\r
-            child.setLocation(x, y);\r
-            child.setSize(cw, ch);\r
+    @Override\r
+    protected Point getInitialSize() {\r
+        if (sLastSize != null) {\r
+            return sLastSize;\r
+        } else {\r
+            // Arbitrary values that look good on my screen and fit on 800x600\r
+            return new Point(740, 370);\r
         }\r
     }\r
 \r
     /**\r
-     * Callback invoked when the Install button is selected. Completes the dialog.\r
-     */\r
-    private void onInstallSelected() {\r
-        mCancelled = false;\r
-        mCompleted = true;\r
-    }\r
-\r
-    /**\r
-     * Callback invoked when the Cancel button is selected.\r
-     */\r
-    private void onCancelSelected() {\r
-        mCancelled = true;\r
-        mCompleted = true;\r
-    }\r
-\r
-    /**\r
      * Callback invoked when a package item is selected in the list.\r
      */\r
     private void onPackageSelected() {\r
@@ -634,7 +570,8 @@ final class UpdateChooserDialog extends Dialog {
                 }\r
             }\r
         }\r
-        mInstallButton.setEnabled(!missing && oneAccepted);\r
+\r
+        getButton(IDialogConstants.OK_ID).setEnabled(!missing && oneAccepted);\r
 \r
         mInternalLicenseRadioUpdate = false;\r
     }\r
index 720ee12..a2a9218 100644 (file)
@@ -374,7 +374,7 @@ final class AvdStartDialog extends GridDialog {
         }
 
         if (sMonitorDpi == -1) { // first time? try to get a value
-             sMonitorDpi = Toolkit.getDefaultToolkit().getScreenResolution();
+            sMonitorDpi = Toolkit.getDefaultToolkit().getScreenResolution();
         }
 
         return sMonitorDpi;