aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchConfiguration.java88
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java127
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java139
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigTabGroup.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/AndroidJUnitTabGroup.java2
5 files changed, 283 insertions, 76 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchConfiguration.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchConfiguration.java
index 2b02c59..df30879 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchConfiguration.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchConfiguration.java
@@ -21,47 +21,48 @@ import org.eclipse.debug.core.ILaunchConfiguration;
/**
* Launch configuration data. This stores the result of querying the
- * {@link ILaunchConfiguration} so that it's only done once.
+ * {@link ILaunchConfiguration} so that it's only done once.
*/
public class AndroidLaunchConfiguration {
-
+
/**
* Launch action. See {@link LaunchConfigDelegate#ACTION_DEFAULT},
* {@link LaunchConfigDelegate#ACTION_ACTIVITY},
* {@link LaunchConfigDelegate#ACTION_DO_NOTHING}
*/
public int mLaunchAction = LaunchConfigDelegate.DEFAULT_LAUNCH_ACTION;
-
- /**
- * Target selection mode for the configuration: either {@link #AUTO} or {@link #MANUAL}.
- */
+
+ /** Target selection mode for the configuration. */
public enum TargetMode {
/** Automatic target selection mode. */
- AUTO(true),
+ AUTO,
/** Manual target selection mode. */
- MANUAL(false);
-
- private boolean mValue;
-
- TargetMode(boolean value) {
- mValue = value;
- }
-
- public boolean getValue() {
- return mValue;
- }
-
- public static TargetMode getMode(boolean value) {
- for (TargetMode mode : values()) {
- if (mode.mValue == value) {
- return mode;
+ MANUAL,
+ /** All active devices */
+ ALL_DEVICES,
+ /** All active emulators */
+ ALL_EMULATORS,
+ /** All active devices and emulators */
+ ALL_DEVICES_AND_EMULATORS;
+
+ public static TargetMode getMode(String s) {
+ for (TargetMode m: values()) {
+ if (m.toString().equals(s)) {
+ return m;
}
}
-
- return null;
+
+ throw new IllegalArgumentException(String.format(
+ "Invalid representation (%s) for TargetMode", s));
+ }
+
+ public boolean isMultiDevice() {
+ return this == ALL_DEVICES
+ || this == ALL_EMULATORS
+ || this == ALL_DEVICES_AND_EMULATORS;
}
}
-
+
/**
* Target selection mode.
* @see TargetMode
@@ -77,12 +78,12 @@ public class AndroidLaunchConfiguration {
* Indicates whether the emulator should be called with -no-boot-anim
*/
public boolean mNoBootAnim = LaunchConfigDelegate.DEFAULT_NO_BOOT_ANIM;
-
+
/**
* AVD Name.
*/
public String mAvdName = null;
-
+
public String mNetworkSpeed = EmulatorConfigTab.getSpeed(
LaunchConfigDelegate.DEFAULT_SPEED);
public String mNetworkDelay = EmulatorConfigTab.getDelay(
@@ -105,13 +106,7 @@ public class AndroidLaunchConfiguration {
// nothing to be done here, we'll use the default value
}
- try {
- boolean value = config.getAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE,
- mTargetMode.getValue());
- mTargetMode = TargetMode.getMode(value);
- } catch (CoreException e) {
- // nothing to be done here, we'll use the default value
- }
+ mTargetMode = parseTargetMode(config, mTargetMode);
try {
mAvdName = config.getAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, mAvdName);
@@ -155,5 +150,28 @@ public class AndroidLaunchConfiguration {
// nothing to be done here, we'll use the default value
}
}
+
+ /**
+ * Retrieve the {@link TargetMode} saved in the provided launch configuration.
+ * Returns defaultMode if there are any errors while retrieving or parsing the saved setting.
+ */
+ public static TargetMode parseTargetMode(ILaunchConfiguration config, TargetMode defaultMode) {
+ try {
+ String value = config.getAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE,
+ defaultMode.toString());
+ return TargetMode.getMode(value);
+ } catch (CoreException e) {
+ // ADT R20 changes the attribute type of ATTR_TARGET_MODE to be a string from a bool.
+ // So if parsing as a string fails, attempt parsing as a boolean.
+ try {
+ boolean value = config.getAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE, true);
+ return value ? TargetMode.AUTO : TargetMode.MANUAL;
+ } catch (CoreException e1) {
+ return defaultMode;
+ }
+ } catch (IllegalArgumentException e) {
+ return defaultMode;
+ }
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
index c35ad2f..aacbeb6 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
@@ -77,9 +77,12 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@@ -211,7 +214,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
// set default target mode
wc.setAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE,
- LaunchConfigDelegate.DEFAULT_TARGET_MODE.getValue());
+ LaunchConfigDelegate.DEFAULT_TARGET_MODE.toString());
// default AVD: None
wc.setAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, (String) null);
@@ -333,7 +336,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
* - Use Last Launched Device/AVD set.
* If user requested to use same device for future launches, and the last launched
* device/avd is still present, then simply launch on the same device/avd.
- * - Manually Mode
+ * - Manual Mode
* Always display a UI that lets a user see the current running emulators/devices.
* The UI must show which devices are compatibles, and allow launching new emulators
* with compatible (and not yet running) AVD.
@@ -345,6 +348,9 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
* Count the number of compatible emulators/devices.
* If != 1, display a UI similar to manual mode.
* If == 1, launch the application on this AVD/device.
+ * - Launch on multiple devices:
+ * From the currently active devices & emulators, filter out those that cannot run
+ * the app (by api level), and launch on all the others.
*/
IDevice[] devices = AndroidDebugBridge.getBridge().getDevices();
IDevice deviceUsedInLastLaunch = DeviceChoiceCache.get(
@@ -563,6 +569,24 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
}
AdtPlugin.printToConsole(project, message);
+ } else if ((config.mTargetMode == TargetMode.ALL_DEVICES_AND_EMULATORS
+ || config.mTargetMode == TargetMode.ALL_DEVICES
+ || config.mTargetMode == TargetMode.ALL_EMULATORS)
+ && ILaunchManager.RUN_MODE.equals(mode)) {
+ // if running on multiple devices, identify all compatible devices
+ boolean includeDevices = config.mTargetMode != TargetMode.ALL_EMULATORS;
+ boolean includeAvds = config.mTargetMode != TargetMode.ALL_DEVICES;
+ Collection<IDevice> compatibleDevices = findCompatibleDevices(devices,
+ requiredApiVersionNumber, includeDevices, includeAvds);
+ if (compatibleDevices.size() == 0) {
+ AdtPlugin.printErrorToConsole(project,
+ "No active compatible AVD's or devices found. "
+ + "Relaunch this configuration after connecting a device or starting an AVD.");
+ stopLaunch(launchInfo);
+ } else {
+ multiLaunch(launchInfo, compatibleDevices);
+ }
+ return;
}
// bring up the device chooser.
@@ -607,6 +631,58 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
}
/**
+ * Returns devices that can run a app of provided API level.
+ * @param devices list of devices to filter from
+ * @param requiredApiVersionNumber minimum required API level that should be supported
+ * @param includeDevices include physical devices in the filtered list
+ * @param includeAvds include emulators in the filtered list
+ * @return set of compatible devices, may be an empty set
+ */
+ private Collection<IDevice> findCompatibleDevices(IDevice[] devices,
+ String requiredApiVersionNumber, boolean includeDevices, boolean includeAvds) {
+ Set<IDevice> compatibleDevices = new HashSet<IDevice>(devices.length);
+ int minApi;
+ try {
+ minApi = Integer.parseInt(requiredApiVersionNumber);
+ } catch (NumberFormatException e) {
+ minApi = 1;
+ }
+ AndroidVersion requiredVersion = new AndroidVersion(minApi, null);
+
+ AvdManager avdManager = Sdk.getCurrent().getAvdManager();
+ for (IDevice d: devices) {
+ boolean isEmulator = d.isEmulator();
+ boolean canRun = false;
+
+ if (isEmulator) {
+ if (!includeAvds) {
+ continue;
+ }
+
+ AvdInfo avdInfo = avdManager.getAvd(d.getAvdName(), true);
+ if (avdInfo != null && avdInfo.getTarget() != null) {
+ canRun = avdInfo.getTarget().getVersion().canRun(requiredVersion);
+ }
+ } else {
+ if (!includeDevices) {
+ continue;
+ }
+
+ AndroidVersion deviceVersion = Sdk.getDeviceVersion(d);
+ if (deviceVersion != null) {
+ canRun = deviceVersion.canRun(requiredVersion);
+ }
+ }
+
+ if (canRun) {
+ compatibleDevices.add(d);
+ }
+ }
+
+ return compatibleDevices;
+ }
+
+ /**
* Find a matching AVD.
*/
private AvdInfo findMatchingAvd(AvdManager avdManager, final IAndroidTarget projectTarget) {
@@ -815,26 +891,49 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
* @return true if succeed
*/
private boolean simpleLaunch(DelayedLaunchInfo launchInfo, IDevice device) {
- // API level check
- if (checkBuildInfo(launchInfo, device) == false) {
+ if (!doPreLaunchActions(launchInfo, device)) {
AdtPlugin.printErrorToConsole(launchInfo.getProject(), "Launch canceled!");
stopLaunch(launchInfo);
return false;
}
- // sync the app
- if (syncApp(launchInfo, device) == false) {
- AdtPlugin.printErrorToConsole(launchInfo.getProject(), "Launch canceled!");
- stopLaunch(launchInfo);
+ // launch the app
+ launchApp(launchInfo, device);
+
+ return true;
+ }
+
+ private boolean doPreLaunchActions(DelayedLaunchInfo launchInfo, IDevice device) {
+ // API level check
+ if (!checkBuildInfo(launchInfo, device)) {
return false;
}
- // launch the app
- launchApp(launchInfo, device);
+ // sync app
+ if (!syncApp(launchInfo, device)) {
+ return false;
+ }
return true;
}
+ private void multiLaunch(DelayedLaunchInfo launchInfo, Collection<IDevice> devices) {
+ for (IDevice d: devices) {
+ boolean success = doPreLaunchActions(launchInfo, d);
+ if (!success) {
+ String deviceName = d.isEmulator() ? d.getAvdName() : d.getSerialNumber();
+ AdtPlugin.printErrorToConsole(launchInfo.getProject(),
+ "Launch failed on device: " + deviceName);
+ continue;
+ }
+
+ doLaunchAction(launchInfo, d);
+ }
+
+ // multiple launches are only supported for run configuration, so we can terminate
+ // the launch itself
+ stopLaunch(launchInfo);
+ }
/**
* If needed, syncs the application and all its dependencies on the device/emulator.
@@ -1154,7 +1253,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
}
}
}
- if (info.getLaunchAction().doLaunchAction(info, device)) {
+ if (doLaunchAction(info, device)) {
// if the app is not a debug app, we need to do some clean up, as
// the process is done!
if (info.isDebugMode() == false) {
@@ -1167,10 +1266,16 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
// lets stop the Launch
stopLaunch(info);
}
+ }
+
+ private boolean doLaunchAction(final DelayedLaunchInfo info, IDevice device) {
+ boolean result = info.getLaunchAction().doLaunchAction(info, device);
// Monitor the logcat output on the launched device to notify
// the user if any significant error occurs that is visible from logcat
DdmsPlugin.getDefault().startLogCatMonitor(device);
+
+ return result;
}
private boolean launchEmulator(AndroidLaunchConfiguration config, AvdInfo avdToLaunch) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java
index 99f582c..3f4ec93 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java
@@ -44,6 +44,7 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -98,6 +99,14 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
private IAndroidTarget mProjectTarget;
+ private boolean mSupportMultiDeviceLaunch;
+ private Button mAllDevicesTargetButton;
+ private Combo mDeviceTypeCombo;
+
+ private static final String DEVICES_AND_EMULATORS = "Active devices and AVD's";
+ private static final String EMULATORS_ONLY = "Active AVD's";
+ private static final String DEVICES_ONLY = "Active devices";
+
/**
* Returns the emulator ready speed option value.
* @param value The index of the combo selection.
@@ -125,11 +134,12 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
/**
*
*/
- public EmulatorConfigTab() {
+ public EmulatorConfigTab(boolean supportMultiDeviceLaunch) {
+ mSupportMultiDeviceLaunch = supportMultiDeviceLaunch;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ /**
+ * @wbp.parser.entryPoint
*/
@Override
public void createControl(Composite parent) {
@@ -165,16 +175,36 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
targetModeGroup.setFont(font);
mManualTargetButton = new Button(targetModeGroup, SWT.RADIO);
- mManualTargetButton.setText("Manual");
- // Since there are only 2 radio buttons, we can put a listener on only one (they
- // are both called on select and unselect event.
+ mManualTargetButton.setText("Always prompt to pick device");
+
+ mAllDevicesTargetButton = new Button(targetModeGroup, SWT.RADIO);
+ mAllDevicesTargetButton.setText("Launch on all compatible devices/AVD's");
+ mAllDevicesTargetButton.setEnabled(mSupportMultiDeviceLaunch);
+
+ Composite deviceTypeOffsetComp = new Composite(targetModeGroup, SWT.NONE);
+ deviceTypeOffsetComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ layout = new GridLayout(1, false);
+ layout.marginRight = layout.marginHeight = 0;
+ layout.marginLeft = 30;
+ deviceTypeOffsetComp.setLayout(layout);
+
+ mDeviceTypeCombo = new Combo(deviceTypeOffsetComp, SWT.READ_ONLY);
+ mDeviceTypeCombo.setItems(new String[] {
+ DEVICES_AND_EMULATORS,
+ EMULATORS_ONLY,
+ DEVICES_ONLY,
+ });
+ mDeviceTypeCombo.select(0);
+ mDeviceTypeCombo.setEnabled(false);
// add the radio button
mAutoTargetButton = new Button(targetModeGroup, SWT.RADIO);
- mAutoTargetButton.setText("Automatic");
+ mAutoTargetButton.setText("Automatically pick compatible device: "
+ + "Always uses preferred AVD if set below, "
+ + "launches on compatible device/AVD otherwise.");
mAutoTargetButton.setSelection(true);
- mAutoTargetButton.addSelectionListener(new SelectionAdapter() {
- // called when selection changes
+
+ SelectionListener targetModeChangeListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
@@ -182,34 +212,43 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
boolean auto = mAutoTargetButton.getSelection();
mPreferredAvdSelector.setEnabled(auto);
mPreferredAvdLabel.setEnabled(auto);
+
+ boolean all = mAllDevicesTargetButton.getSelection();
+ mDeviceTypeCombo.setEnabled(all);
}
- });
+ };
+
+ mAutoTargetButton.addSelectionListener(targetModeChangeListener);
+ mAllDevicesTargetButton.addSelectionListener(targetModeChangeListener);
+ mManualTargetButton.addSelectionListener(targetModeChangeListener);
- Composite offsetComp = new Composite(targetModeGroup, SWT.NONE);
- offsetComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Composite avdOffsetComp = new Composite(targetModeGroup, SWT.NONE);
+ avdOffsetComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
layout = new GridLayout(1, false);
layout.marginRight = layout.marginHeight = 0;
layout.marginLeft = 30;
- offsetComp.setLayout(layout);
+ avdOffsetComp.setLayout(layout);
- mPreferredAvdLabel = new Label(offsetComp, SWT.NONE);
+ mPreferredAvdLabel = new Label(avdOffsetComp, SWT.NONE);
mPreferredAvdLabel.setText("Select a preferred Android Virtual Device for deployment:");
// create the selector with no manager, we'll reset the manager every time this is
// displayed to ensure we have the latest one (dialog is reused but SDK could have
// been changed in between.
- mPreferredAvdSelector = new AvdSelector(offsetComp,
+ mPreferredAvdSelector = new AvdSelector(avdOffsetComp,
Sdk.getCurrent().getSdkLocation(),
null /* avd manager */,
DisplayMode.SIMPLE_CHECK,
new AdtConsoleSdkLog());
mPreferredAvdSelector.setTableHeightHint(100);
- mPreferredAvdSelector.setSelectionListener(new SelectionAdapter() {
+ SelectionListener listener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
- });
+ };
+ mPreferredAvdSelector.setSelectionListener(listener);
+ mDeviceTypeCombo.addSelectionListener(listener);
// emulator size
mEmulatorOptionsGroup = new Group(topComp, SWT.NONE);
@@ -220,6 +259,14 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
mEmulatorOptionsGroup.setLayout(layout);
mEmulatorOptionsGroup.setFont(font);
+ // Explanation
+ Label l = new Label(mEmulatorOptionsGroup, SWT.NONE);
+ l.setText("If no compatible and active devices or AVD's are found, then an AVD "
+ + "might be launched. Provide options for the AVD launch below.");
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ l.setLayoutData(gd);
+
// network options
new Label(mEmulatorOptionsGroup, SWT.NONE).setText("Network Speed:");
@@ -281,7 +328,7 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
});
// custom command line option for emulator
- Label l = new Label(mEmulatorOptionsGroup, SWT.NONE);
+ l = new Label(mEmulatorOptionsGroup, SWT.NONE);
l.setText("Additional Emulator Command Line Options");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
@@ -329,15 +376,32 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
public void initializeFrom(ILaunchConfiguration configuration) {
AvdManager avdManager = Sdk.getCurrent().getAvdManager();
- TargetMode mode = LaunchConfigDelegate.DEFAULT_TARGET_MODE; // true == automatic
- try {
- mode = TargetMode.getMode(configuration.getAttribute(
- LaunchConfigDelegate.ATTR_TARGET_MODE, mode.getValue()));
- } catch (CoreException e) {
- // let's not do anything here, we'll use the default value
+ TargetMode mode = AndroidLaunchConfiguration.parseTargetMode(configuration,
+ LaunchConfigDelegate.DEFAULT_TARGET_MODE);
+
+ boolean multipleDevices = mode.isMultiDevice();
+ if (multipleDevices && !mSupportMultiDeviceLaunch) {
+ // The launch config says to run on multiple devices, but this launch type does not
+ // suppport multiple devices. In such a case, switch back to default mode.
+ // This could happen if a launch config used for Run is then used for Debug.
+ multipleDevices = false;
+ mode = LaunchConfigDelegate.DEFAULT_TARGET_MODE;
+ }
+
+ mAutoTargetButton.setSelection(mode == TargetMode.AUTO);
+ mManualTargetButton.setSelection(mode == TargetMode.MANUAL);
+ mAllDevicesTargetButton.setSelection(multipleDevices);
+
+ mDeviceTypeCombo.setEnabled(multipleDevices);
+ if (multipleDevices) {
+ int index = 0;
+ if (mode == TargetMode.ALL_EMULATORS) {
+ index = 1;
+ } else if (mode == TargetMode.ALL_DEVICES) {
+ index = 2;
+ }
+ mDeviceTypeCombo.select(index);
}
- mAutoTargetButton.setSelection(mode.getValue());
- mManualTargetButton.setSelection(!mode.getValue());
// look for the project name to get its target.
String stringValue = "";
@@ -447,7 +511,7 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE,
- mAutoTargetButton.getSelection());
+ getCurrentTargetMode().toString());
AvdInfo avd = mPreferredAvdSelector.getSelected();
if (avd != null) {
configuration.setAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, avd.getName());
@@ -466,13 +530,32 @@ public class EmulatorConfigTab extends AbstractLaunchConfigurationTab {
mNoBootAnimButton.getSelection());
}
+ private TargetMode getCurrentTargetMode() {
+ if (mAutoTargetButton.getSelection()) {
+ return TargetMode.AUTO;
+ } else if (mManualTargetButton.getSelection()) {
+ return TargetMode.MANUAL;
+ } else {
+ String selection = mDeviceTypeCombo.getText();
+ if (DEVICES_AND_EMULATORS.equals(selection)) {
+ return TargetMode.ALL_DEVICES_AND_EMULATORS;
+ } else if (DEVICES_ONLY.equals(selection)) {
+ return TargetMode.ALL_DEVICES;
+ } else if (EMULATORS_ONLY.equals(selection)) {
+ return TargetMode.ALL_EMULATORS;
+ }
+ }
+
+ return TargetMode.AUTO;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE,
- LaunchConfigDelegate.DEFAULT_TARGET_MODE.getValue());
+ LaunchConfigDelegate.DEFAULT_TARGET_MODE.toString());
configuration.setAttribute(LaunchConfigDelegate.ATTR_SPEED,
LaunchConfigDelegate.DEFAULT_SPEED);
configuration.setAttribute(LaunchConfigDelegate.ATTR_DELAY,
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigTabGroup.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigTabGroup.java
index a68e500..fbf17ce 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigTabGroup.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/LaunchConfigTabGroup.java
@@ -16,6 +16,7 @@
package com.android.ide.eclipse.adt.internal.launch;
+import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
@@ -33,7 +34,7 @@ public class LaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup {
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
new MainLaunchConfigTab(),
- new EmulatorConfigTab(),
+ new EmulatorConfigTab(ILaunchManager.RUN_MODE.equals(mode)),
new CommonTab()
};
setTabs(tabs);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/AndroidJUnitTabGroup.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/AndroidJUnitTabGroup.java
index d9a44ed..13ddcc6 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/AndroidJUnitTabGroup.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/junit/AndroidJUnitTabGroup.java
@@ -35,7 +35,7 @@ public class AndroidJUnitTabGroup extends AbstractLaunchConfigurationTabGroup {
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
new AndroidJUnitLaunchConfigurationTab(),
- new EmulatorConfigTab(),
+ new EmulatorConfigTab(false),
new CommonTab()
};
setTabs(tabs);