1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.eclipse.adt.internal.launch; 18 19 import com.android.ddmuilib.ImageLoader; 20 import com.android.ide.eclipse.adt.AdtPlugin; 21 import com.android.ide.eclipse.adt.internal.editors.manifest.ManifestInfo; 22 import com.android.ide.eclipse.adt.internal.launch.AndroidLaunchConfiguration.TargetMode; 23 import com.android.ide.eclipse.adt.internal.launch.AvdCompatibility.Compatibility; 24 import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; 25 import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper; 26 import com.android.ide.eclipse.adt.internal.sdk.AdtConsoleSdkLog; 27 import com.android.ide.eclipse.adt.internal.sdk.Sdk; 28 import com.android.prefs.AndroidLocation.AndroidLocationException; 29 import com.android.sdklib.AndroidVersion; 30 import com.android.sdklib.IAndroidTarget; 31 import com.android.sdklib.internal.avd.AvdInfo; 32 import com.android.sdklib.internal.avd.AvdManager; 33 import com.android.sdkuilib.internal.widgets.AvdSelector; 34 import com.android.sdkuilib.internal.widgets.AvdSelector.DisplayMode; 35 import com.android.sdkuilib.internal.widgets.AvdSelector.IAvdFilter; 36 import com.android.utils.NullLogger; 37 38 import org.eclipse.core.resources.IProject; 39 import org.eclipse.core.runtime.CoreException; 40 import org.eclipse.debug.core.ILaunchConfiguration; 41 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 42 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; 43 import org.eclipse.jdt.core.IJavaProject; 44 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; 45 import org.eclipse.jface.preference.IPreferenceStore; 46 import org.eclipse.swt.SWT; 47 import org.eclipse.swt.events.ModifyEvent; 48 import org.eclipse.swt.events.ModifyListener; 49 import org.eclipse.swt.events.SelectionAdapter; 50 import org.eclipse.swt.events.SelectionEvent; 51 import org.eclipse.swt.events.SelectionListener; 52 import org.eclipse.swt.graphics.Font; 53 import org.eclipse.swt.graphics.Image; 54 import org.eclipse.swt.layout.GridData; 55 import org.eclipse.swt.layout.GridLayout; 56 import org.eclipse.swt.widgets.Button; 57 import org.eclipse.swt.widgets.Combo; 58 import org.eclipse.swt.widgets.Composite; 59 import org.eclipse.swt.widgets.Group; 60 import org.eclipse.swt.widgets.Label; 61 import org.eclipse.swt.widgets.Text; 62 63 /** 64 * Launch configuration tab to control the parameters of the Emulator 65 */ 66 public class EmulatorConfigTab extends AbstractLaunchConfigurationTab { 67 68 private final static String[][] NETWORK_SPEEDS = new String[][] { 69 { "Full", "full" }, //$NON-NLS-2$ 70 { "GSM", "gsm" }, //$NON-NLS-2$ 71 { "HSCSD", "hscsd" }, //$NON-NLS-2$ 72 { "GPRS", "gprs" }, //$NON-NLS-2$ 73 { "EDGE", "edge" }, //$NON-NLS-2$ 74 { "UMTS", "umts" }, //$NON-NLS-2$ 75 { "HSPDA", "hsdpa" }, //$NON-NLS-2$ 76 }; 77 78 private final static String[][] NETWORK_LATENCIES = new String[][] { 79 { "None", "none" }, //$NON-NLS-2$ 80 { "GPRS", "gprs" }, //$NON-NLS-2$ 81 { "EDGE", "edge" }, //$NON-NLS-2$ 82 { "UMTS", "umts" }, //$NON-NLS-2$ 83 }; 84 85 private Button mAutoTargetButton; 86 private Button mManualTargetButton; 87 88 private AvdSelector mPreferredAvdSelector; 89 90 private Combo mSpeedCombo; 91 92 private Combo mDelayCombo; 93 94 private Group mEmulatorOptionsGroup; 95 96 private Text mEmulatorCLOptions; 97 98 private Button mWipeDataButton; 99 100 private Button mNoBootAnimButton; 101 102 private Label mPreferredAvdLabel; 103 104 private IAndroidTarget mProjectTarget; 105 private AndroidVersion mProjectMinApiVersion; 106 107 private boolean mSupportMultiDeviceLaunch; 108 private Button mAllDevicesTargetButton; 109 private Combo mDeviceTypeCombo; 110 111 private static final String DEVICES_AND_EMULATORS = "Active devices and AVD's"; 112 private static final String EMULATORS_ONLY = "Active AVD's"; 113 private static final String DEVICES_ONLY = "Active devices"; 114 115 /** 116 * Returns the emulator ready speed option value. 117 * @param value The index of the combo selection. 118 */ 119 public static String getSpeed(int value) { 120 try { 121 return NETWORK_SPEEDS[value][1]; 122 } catch (ArrayIndexOutOfBoundsException e) { 123 return NETWORK_SPEEDS[LaunchConfigDelegate.DEFAULT_SPEED][1]; 124 } 125 } 126 127 /** 128 * Returns the emulator ready network latency value. 129 * @param value The index of the combo selection. 130 */ 131 public static String getDelay(int value) { 132 try { 133 return NETWORK_LATENCIES[value][1]; 134 } catch (ArrayIndexOutOfBoundsException e) { 135 return NETWORK_LATENCIES[LaunchConfigDelegate.DEFAULT_DELAY][1]; 136 } 137 } 138 139 /** 140 * 141 */ 142 public EmulatorConfigTab(boolean supportMultiDeviceLaunch) { 143 mSupportMultiDeviceLaunch = supportMultiDeviceLaunch; 144 } 145 146 /** 147 * @wbp.parser.entryPoint 148 */ 149 @Override 150 public void createControl(Composite parent) { 151 Font font = parent.getFont(); 152 153 // Reload the AVDs to make sure we are up to date 154 try { 155 // SDK can be null if the user opens the dialog before ADT finished 156 // initializing the SDK itself. In this case just don't reload anything 157 // so there's nothing obsolete yet. 158 Sdk sdk = Sdk.getCurrent(); 159 if (sdk != null) { 160 AvdManager avdMan = sdk.getAvdManager(); 161 assert avdMan != null; 162 avdMan.reloadAvds(NullLogger.getLogger()); 163 } 164 } catch (AndroidLocationException e1) { 165 // this happens if the AVD Manager failed to find the folder in which the AVDs are 166 // stored. There isn't much we can do at this point. 167 } 168 169 Composite topComp = new Composite(parent, SWT.NONE); 170 setControl(topComp); 171 GridLayout topLayout = new GridLayout(); 172 topLayout.numColumns = 1; 173 topLayout.verticalSpacing = 0; 174 topComp.setLayout(topLayout); 175 topComp.setFont(font); 176 177 GridData gd; 178 GridLayout layout; 179 180 // radio button for the target mode 181 Group targetModeGroup = new Group(topComp, SWT.NONE); 182 targetModeGroup.setText("Deployment Target Selection Mode"); 183 gd = new GridData(GridData.FILL_HORIZONTAL); 184 targetModeGroup.setLayoutData(gd); 185 layout = new GridLayout(); 186 layout.numColumns = 1; 187 targetModeGroup.setLayout(layout); 188 targetModeGroup.setFont(font); 189 190 mManualTargetButton = new Button(targetModeGroup, SWT.RADIO); 191 mManualTargetButton.setText("Always prompt to pick device"); 192 193 mAllDevicesTargetButton = new Button(targetModeGroup, SWT.RADIO); 194 mAllDevicesTargetButton.setText("Launch on all compatible devices/AVD's"); 195 mAllDevicesTargetButton.setEnabled(mSupportMultiDeviceLaunch); 196 197 Composite deviceTypeOffsetComp = new Composite(targetModeGroup, SWT.NONE); 198 deviceTypeOffsetComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 199 layout = new GridLayout(1, false); 200 layout.marginRight = layout.marginHeight = 0; 201 layout.marginLeft = 30; 202 deviceTypeOffsetComp.setLayout(layout); 203 204 mDeviceTypeCombo = new Combo(deviceTypeOffsetComp, SWT.READ_ONLY); 205 mDeviceTypeCombo.setItems(new String[] { 206 DEVICES_AND_EMULATORS, 207 EMULATORS_ONLY, 208 DEVICES_ONLY, 209 }); 210 mDeviceTypeCombo.select(0); 211 mDeviceTypeCombo.setEnabled(false); 212 213 // add the radio button 214 mAutoTargetButton = new Button(targetModeGroup, SWT.RADIO); 215 mAutoTargetButton.setText("Automatically pick compatible device: " 216 + "Always uses preferred AVD if set below, " 217 + "launches on compatible device/AVD otherwise."); 218 mAutoTargetButton.setSelection(true); 219 220 SelectionListener targetModeChangeListener = new SelectionAdapter() { 221 @Override 222 public void widgetSelected(SelectionEvent e) { 223 targetModeChanged(); 224 } 225 }; 226 227 mAutoTargetButton.addSelectionListener(targetModeChangeListener); 228 mAllDevicesTargetButton.addSelectionListener(targetModeChangeListener); 229 mManualTargetButton.addSelectionListener(targetModeChangeListener); 230 231 Composite avdOffsetComp = new Composite(targetModeGroup, SWT.NONE); 232 avdOffsetComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 233 layout = new GridLayout(1, false); 234 layout.marginRight = layout.marginHeight = 0; 235 layout.marginLeft = 30; 236 avdOffsetComp.setLayout(layout); 237 238 mPreferredAvdLabel = new Label(avdOffsetComp, SWT.NONE); 239 mPreferredAvdLabel.setText("Select a preferred Android Virtual Device for deployment:"); 240 241 // create the selector with no manager, we'll reset the manager every time this is 242 // displayed to ensure we have the latest one (dialog is reused but SDK could have 243 // been changed in between. 244 mPreferredAvdSelector = new AvdSelector(avdOffsetComp, 245 Sdk.getCurrent().getSdkLocation(), 246 null /* avd manager */, 247 DisplayMode.SIMPLE_CHECK, 248 new AdtConsoleSdkLog()); 249 mPreferredAvdSelector.setTableHeightHint(100); 250 SelectionListener listener = new SelectionAdapter() { 251 @Override 252 public void widgetSelected(SelectionEvent e) { 253 updateLaunchConfigurationDialog(); 254 } 255 }; 256 mPreferredAvdSelector.setSelectionListener(listener); 257 mDeviceTypeCombo.addSelectionListener(listener); 258 259 // emulator size 260 mEmulatorOptionsGroup = new Group(topComp, SWT.NONE); 261 mEmulatorOptionsGroup.setText("Emulator launch parameters:"); 262 mEmulatorOptionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 263 layout = new GridLayout(); 264 layout.numColumns = 2; 265 mEmulatorOptionsGroup.setLayout(layout); 266 mEmulatorOptionsGroup.setFont(font); 267 268 // Explanation 269 Label l = new Label(mEmulatorOptionsGroup, SWT.NONE); 270 l.setText("If no compatible and active devices or AVD's are found, then an AVD " 271 + "might be launched. Provide options for the AVD launch below."); 272 gd = new GridData(); 273 gd.horizontalSpan = 2; 274 l.setLayoutData(gd); 275 276 // network options 277 new Label(mEmulatorOptionsGroup, SWT.NONE).setText("Network Speed:"); 278 279 mSpeedCombo = new Combo(mEmulatorOptionsGroup, SWT.READ_ONLY); 280 for (String[] speed : NETWORK_SPEEDS) { 281 mSpeedCombo.add(speed[0]); 282 } 283 mSpeedCombo.addSelectionListener(new SelectionAdapter() { 284 // called when selection changes 285 @Override 286 public void widgetSelected(SelectionEvent e) { 287 updateLaunchConfigurationDialog(); 288 } 289 }); 290 mSpeedCombo.pack(); 291 292 new Label(mEmulatorOptionsGroup, SWT.NONE).setText("Network Latency:"); 293 294 mDelayCombo = new Combo(mEmulatorOptionsGroup, SWT.READ_ONLY); 295 296 for (String[] delay : NETWORK_LATENCIES) { 297 mDelayCombo.add(delay[0]); 298 } 299 mDelayCombo.addSelectionListener(new SelectionAdapter() { 300 // called when selection changes 301 @Override 302 public void widgetSelected(SelectionEvent e) { 303 updateLaunchConfigurationDialog(); 304 } 305 }); 306 mDelayCombo.pack(); 307 308 // wipe data option 309 mWipeDataButton = new Button(mEmulatorOptionsGroup, SWT.CHECK); 310 mWipeDataButton.setText("Wipe User Data"); 311 mWipeDataButton.setToolTipText("Check this if you want to wipe your user data each time you start the emulator. You will be prompted for confirmation when the emulator starts."); 312 gd = new GridData(GridData.FILL_HORIZONTAL); 313 gd.horizontalSpan = 2; 314 mWipeDataButton.setLayoutData(gd); 315 mWipeDataButton.addSelectionListener(new SelectionAdapter() { 316 @Override 317 public void widgetSelected(SelectionEvent e) { 318 updateLaunchConfigurationDialog(); 319 } 320 }); 321 322 // no boot anim option 323 mNoBootAnimButton = new Button(mEmulatorOptionsGroup, SWT.CHECK); 324 mNoBootAnimButton.setText("Disable Boot Animation"); 325 mNoBootAnimButton.setToolTipText("Check this if you want to disable the boot animation. This can help the emulator start faster on slow machines."); 326 gd = new GridData(GridData.FILL_HORIZONTAL); 327 gd.horizontalSpan = 2; 328 mNoBootAnimButton.setLayoutData(gd); 329 mNoBootAnimButton.addSelectionListener(new SelectionAdapter() { 330 @Override 331 public void widgetSelected(SelectionEvent e) { 332 updateLaunchConfigurationDialog(); 333 } 334 }); 335 336 // custom command line option for emulator 337 l = new Label(mEmulatorOptionsGroup, SWT.NONE); 338 l.setText("Additional Emulator Command Line Options"); 339 gd = new GridData(GridData.FILL_HORIZONTAL); 340 gd.horizontalSpan = 2; 341 l.setLayoutData(gd); 342 343 mEmulatorCLOptions = new Text(mEmulatorOptionsGroup, SWT.BORDER); 344 gd = new GridData(GridData.FILL_HORIZONTAL); 345 gd.horizontalSpan = 2; 346 mEmulatorCLOptions.setLayoutData(gd); 347 mEmulatorCLOptions.addModifyListener(new ModifyListener() { 348 @Override 349 public void modifyText(ModifyEvent e) { 350 updateLaunchConfigurationDialog(); 351 } 352 }); 353 } 354 355 private void targetModeChanged() { 356 updateLaunchConfigurationDialog(); 357 358 boolean auto = mAutoTargetButton.getSelection(); 359 mPreferredAvdSelector.setEnabled(auto); 360 mPreferredAvdLabel.setEnabled(auto); 361 362 boolean all = mAllDevicesTargetButton.getSelection(); 363 mDeviceTypeCombo.setEnabled(all); 364 } 365 366 /* (non-Javadoc) 367 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() 368 */ 369 @Override 370 public String getName() { 371 return "Target"; 372 } 373 374 @Override 375 public Image getImage() { 376 return ImageLoader.getDdmUiLibLoader().loadImage("emulator.png", null); //$NON-NLS-1$ 377 } 378 379 private void updateAvdList(AvdManager avdManager) { 380 if (avdManager == null) { 381 avdManager = Sdk.getCurrent().getAvdManager(); 382 } 383 384 mPreferredAvdSelector.setManager(avdManager); 385 mPreferredAvdSelector.refresh(false); 386 387 mPreferredAvdSelector.setFilter(new IAvdFilter() { 388 @Override 389 public void prepare() { 390 } 391 392 @Override 393 public void cleanup() { 394 } 395 396 @Override 397 public boolean accept(AvdInfo avd) { 398 AvdCompatibility.Compatibility c = 399 AvdCompatibility.canRun(avd, mProjectTarget, mProjectMinApiVersion); 400 return (c == Compatibility.NO) ? false : true; 401 } 402 }); 403 } 404 405 /* (non-Javadoc) 406 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) 407 */ 408 @Override 409 public void initializeFrom(ILaunchConfiguration configuration) { 410 AvdManager avdManager = Sdk.getCurrent().getAvdManager(); 411 412 TargetMode mode = AndroidLaunchConfiguration.parseTargetMode(configuration, 413 LaunchConfigDelegate.DEFAULT_TARGET_MODE); 414 415 boolean multipleDevices = mode.isMultiDevice(); 416 if (multipleDevices && !mSupportMultiDeviceLaunch) { 417 // The launch config says to run on multiple devices, but this launch type does not 418 // suppport multiple devices. In such a case, switch back to default mode. 419 // This could happen if a launch config used for Run is then used for Debug. 420 multipleDevices = false; 421 mode = LaunchConfigDelegate.DEFAULT_TARGET_MODE; 422 } 423 424 mAutoTargetButton.setSelection(mode == TargetMode.AUTO); 425 mManualTargetButton.setSelection(mode == TargetMode.MANUAL); 426 mAllDevicesTargetButton.setSelection(multipleDevices); 427 428 targetModeChanged(); 429 430 mDeviceTypeCombo.setEnabled(multipleDevices); 431 if (multipleDevices) { 432 int index = 0; 433 if (mode == TargetMode.ALL_EMULATORS) { 434 index = 1; 435 } else if (mode == TargetMode.ALL_DEVICES) { 436 index = 2; 437 } 438 mDeviceTypeCombo.select(index); 439 } 440 441 // look for the project name to get its target. 442 String stringValue = ""; 443 try { 444 stringValue = configuration.getAttribute( 445 IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, stringValue); 446 } catch (CoreException ce) { 447 // let's not do anything here, we'll use the default value 448 } 449 450 IProject project = null; 451 452 // get the list of existing Android projects from the workspace. 453 IJavaProject[] projects = BaseProjectHelper.getAndroidProjects(null /*filter*/); 454 if (projects != null) { 455 // look for the project whose name we read from the configuration. 456 for (IJavaProject p : projects) { 457 if (p.getElementName().equals(stringValue)) { 458 project = p.getProject(); 459 break; 460 } 461 } 462 } 463 464 // update the AVD list 465 if (project != null) { 466 mProjectTarget = Sdk.getCurrent().getTarget(project); 467 468 ManifestInfo mi = ManifestInfo.get(project); 469 final int minApiLevel = mi.getMinSdkVersion(); 470 final String minApiCodeName = mi.getMinSdkCodeName(); 471 mProjectMinApiVersion = new AndroidVersion(minApiLevel, minApiCodeName); 472 } 473 474 updateAvdList(avdManager); 475 476 stringValue = ""; 477 try { 478 stringValue = configuration.getAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, 479 stringValue); 480 } catch (CoreException e) { 481 // let's not do anything here, we'll use the default value 482 } 483 484 if (stringValue != null && stringValue.length() > 0 && avdManager != null) { 485 AvdInfo targetAvd = avdManager.getAvd(stringValue, true /*validAvdOnly*/); 486 mPreferredAvdSelector.setSelection(targetAvd); 487 } else { 488 mPreferredAvdSelector.setSelection(null); 489 } 490 491 boolean value = LaunchConfigDelegate.DEFAULT_WIPE_DATA; 492 try { 493 value = configuration.getAttribute(LaunchConfigDelegate.ATTR_WIPE_DATA, value); 494 } catch (CoreException e) { 495 // let's not do anything here, we'll use the default value 496 } 497 mWipeDataButton.setSelection(value); 498 499 value = LaunchConfigDelegate.DEFAULT_NO_BOOT_ANIM; 500 try { 501 value = configuration.getAttribute(LaunchConfigDelegate.ATTR_NO_BOOT_ANIM, value); 502 } catch (CoreException e) { 503 // let's not do anything here, we'll use the default value 504 } 505 mNoBootAnimButton.setSelection(value); 506 507 int index = -1; 508 509 index = LaunchConfigDelegate.DEFAULT_SPEED; 510 try { 511 index = configuration.getAttribute(LaunchConfigDelegate.ATTR_SPEED, 512 index); 513 } catch (CoreException e) { 514 // let's not do anything here, we'll use the default value 515 } 516 if (index == -1) { 517 mSpeedCombo.clearSelection(); 518 } else { 519 mSpeedCombo.select(index); 520 } 521 522 index = LaunchConfigDelegate.DEFAULT_DELAY; 523 try { 524 index = configuration.getAttribute(LaunchConfigDelegate.ATTR_DELAY, 525 index); 526 } catch (CoreException e) { 527 // let's not do anything here, we'll put a proper value in 528 // performApply anyway 529 } 530 if (index == -1) { 531 mDelayCombo.clearSelection(); 532 } else { 533 mDelayCombo.select(index); 534 } 535 536 String commandLine = null; 537 try { 538 commandLine = configuration.getAttribute( 539 LaunchConfigDelegate.ATTR_COMMANDLINE, ""); //$NON-NLS-1$ 540 } catch (CoreException e) { 541 // let's not do anything here, we'll use the default value 542 } 543 if (commandLine != null) { 544 mEmulatorCLOptions.setText(commandLine); 545 } 546 } 547 548 /* (non-Javadoc) 549 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) 550 */ 551 @Override 552 public void performApply(ILaunchConfigurationWorkingCopy configuration) { 553 configuration.setAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE, 554 getCurrentTargetMode().toString()); 555 AvdInfo avd = mPreferredAvdSelector.getSelected(); 556 if (avd != null) { 557 configuration.setAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, avd.getName()); 558 } else { 559 configuration.setAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, (String)null); 560 } 561 configuration.setAttribute(LaunchConfigDelegate.ATTR_SPEED, 562 mSpeedCombo.getSelectionIndex()); 563 configuration.setAttribute(LaunchConfigDelegate.ATTR_DELAY, 564 mDelayCombo.getSelectionIndex()); 565 configuration.setAttribute(LaunchConfigDelegate.ATTR_COMMANDLINE, 566 mEmulatorCLOptions.getText()); 567 configuration.setAttribute(LaunchConfigDelegate.ATTR_WIPE_DATA, 568 mWipeDataButton.getSelection()); 569 configuration.setAttribute(LaunchConfigDelegate.ATTR_NO_BOOT_ANIM, 570 mNoBootAnimButton.getSelection()); 571 } 572 573 private TargetMode getCurrentTargetMode() { 574 if (mAutoTargetButton.getSelection()) { 575 return TargetMode.AUTO; 576 } else if (mManualTargetButton.getSelection()) { 577 return TargetMode.MANUAL; 578 } else { 579 String selection = mDeviceTypeCombo.getText(); 580 if (DEVICES_AND_EMULATORS.equals(selection)) { 581 return TargetMode.ALL_DEVICES_AND_EMULATORS; 582 } else if (DEVICES_ONLY.equals(selection)) { 583 return TargetMode.ALL_DEVICES; 584 } else if (EMULATORS_ONLY.equals(selection)) { 585 return TargetMode.ALL_EMULATORS; 586 } 587 } 588 589 return TargetMode.AUTO; 590 } 591 592 /* (non-Javadoc) 593 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) 594 */ 595 @Override 596 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { 597 configuration.setAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE, 598 LaunchConfigDelegate.DEFAULT_TARGET_MODE.toString()); 599 configuration.setAttribute(LaunchConfigDelegate.ATTR_SPEED, 600 LaunchConfigDelegate.DEFAULT_SPEED); 601 configuration.setAttribute(LaunchConfigDelegate.ATTR_DELAY, 602 LaunchConfigDelegate.DEFAULT_DELAY); 603 configuration.setAttribute(LaunchConfigDelegate.ATTR_WIPE_DATA, 604 LaunchConfigDelegate.DEFAULT_WIPE_DATA); 605 configuration.setAttribute(LaunchConfigDelegate.ATTR_NO_BOOT_ANIM, 606 LaunchConfigDelegate.DEFAULT_NO_BOOT_ANIM); 607 608 IPreferenceStore store = AdtPlugin.getDefault().getPreferenceStore(); 609 String emuOptions = store.getString(AdtPrefs.PREFS_EMU_OPTIONS); 610 configuration.setAttribute(LaunchConfigDelegate.ATTR_COMMANDLINE, emuOptions); 611 } 612 } 613