64 import org.eclipse.swt.widgets.Button; |
64 import org.eclipse.swt.widgets.Button; |
65 import org.eclipse.swt.widgets.Combo; |
65 import org.eclipse.swt.widgets.Combo; |
66 import org.eclipse.swt.widgets.Composite; |
66 import org.eclipse.swt.widgets.Composite; |
67 import org.eclipse.swt.widgets.Display; |
67 import org.eclipse.swt.widgets.Display; |
68 import org.eclipse.swt.widgets.FileDialog; |
68 import org.eclipse.swt.widgets.FileDialog; |
|
69 import org.eclipse.swt.widgets.Group; |
69 import org.eclipse.swt.widgets.Label; |
70 import org.eclipse.swt.widgets.Label; |
|
71 import org.eclipse.swt.widgets.Link; |
70 import org.eclipse.swt.widgets.Text; |
72 import org.eclipse.swt.widgets.Text; |
71 import org.eclipse.ui.dialogs.ElementListSelectionDialog; |
73 import org.eclipse.ui.dialogs.ElementListSelectionDialog; |
|
74 import org.eclipse.ui.dialogs.PreferencesUtil; |
72 import org.eclipse.ui.dialogs.TwoPaneElementSelector; |
75 import org.eclipse.ui.dialogs.TwoPaneElementSelector; |
73 |
76 |
74 /** |
77 /** |
75 * A launch configuration tab that displays and edits project and main type name launch |
78 * A launch configuration tab that displays and edits project and main type name launch |
76 * configuration attributes. |
79 * configuration attributes. |
112 |
115 |
113 /** |
116 /** |
114 * @since 6.0 |
117 * @since 6.0 |
115 */ |
118 */ |
116 protected Combo fBuildConfigCombo; |
119 protected Combo fBuildConfigCombo; |
|
120 // Build option UI widgets |
|
121 protected Button fDisableBuildButton; |
|
122 protected Button fEnableBuildButton; |
|
123 protected Button fWorkspaceSettingsButton; |
|
124 protected Link fWorkpsaceSettingsLink; |
117 |
125 |
118 private final boolean fWantsTerminalOption; |
126 private final boolean fWantsTerminalOption; |
119 protected Button fTerminalButton; |
127 protected Button fTerminalButton; |
120 |
128 |
121 private final boolean dontCheckProgram; |
129 private final boolean dontCheckProgram; |
162 comp.setLayout(topLayout); |
170 comp.setLayout(topLayout); |
163 |
171 |
164 createVerticalSpacer(comp, 1); |
172 createVerticalSpacer(comp, 1); |
165 createProjectGroup(comp, 1); |
173 createProjectGroup(comp, 1); |
166 createBuildConfigCombo(comp, 1); |
174 createBuildConfigCombo(comp, 1); |
|
175 createBuildOptionGroup(comp, 1); |
167 createExeFileGroup(comp, 1); |
176 createExeFileGroup(comp, 1); |
168 createVerticalSpacer(comp, 1); |
177 createVerticalSpacer(comp, 1); |
169 if (fSpecifyCoreFile) { |
178 if (fSpecifyCoreFile) { |
170 createCoreFileGroup(comp, 1); |
179 createCoreFileGroup(comp, 1); |
171 } |
180 } |
318 updateLaunchConfigurationDialog(); |
327 updateLaunchConfigurationDialog(); |
319 } |
328 } |
320 }); |
329 }); |
321 } |
330 } |
322 |
331 |
|
332 protected void createBuildOptionGroup(final Composite parent, int colSpan) { |
|
333 Group buildGroup = new Group(parent, SWT.NONE); |
|
334 GridData gridData = new GridData(GridData.FILL_HORIZONTAL); |
|
335 gridData.horizontalSpan = colSpan; |
|
336 GridLayout gridLayout = new GridLayout(); |
|
337 gridLayout.numColumns = 2; |
|
338 gridLayout.marginHeight = 5; |
|
339 gridLayout.marginWidth = 5; |
|
340 gridLayout.makeColumnsEqualWidth= true; |
|
341 buildGroup.setLayoutData(gridData); |
|
342 buildGroup.setLayout(gridLayout); |
|
343 buildGroup.setText("Build (if required) before launching"); //$NON-NLS-1$ |
|
344 |
|
345 fDisableBuildButton = new Button(buildGroup, SWT.RADIO); |
|
346 fDisableBuildButton.setText(LaunchMessages.getString("CMainTab.Disable_build_button_label")); //$NON-NLS-1$ |
|
347 fDisableBuildButton.setToolTipText(LaunchMessages.getString("CMainTab.Disable_build_button_tooltip")); //$NON-NLS-1$ |
|
348 fDisableBuildButton.addSelectionListener(new SelectionAdapter() { |
|
349 |
|
350 public void widgetSelected(SelectionEvent evt) { |
|
351 updateLaunchConfigurationDialog(); |
|
352 } |
|
353 }); |
|
354 |
|
355 new Label(buildGroup, SWT.NONE); |
|
356 |
|
357 fEnableBuildButton = new Button(buildGroup, SWT.RADIO); |
|
358 fEnableBuildButton.setText(LaunchMessages.getString("CMainTab.Enable_build_button_label")); //$NON-NLS-1$ |
|
359 fEnableBuildButton.setToolTipText(LaunchMessages.getString("CMainTab.Enable_build_button_tooltip")); //$NON-NLS-1$ |
|
360 fEnableBuildButton.addSelectionListener(new SelectionAdapter() { |
|
361 |
|
362 public void widgetSelected(SelectionEvent evt) { |
|
363 updateLaunchConfigurationDialog(); |
|
364 } |
|
365 }); |
|
366 |
|
367 new Label(buildGroup, SWT.NONE); |
|
368 |
|
369 fWorkspaceSettingsButton = new Button(buildGroup, SWT.RADIO); |
|
370 fWorkspaceSettingsButton.setText(LaunchMessages.getString("CMainTab.Workspace_settings_button_label")); //$NON-NLS-1$ |
|
371 fWorkspaceSettingsButton.setToolTipText(LaunchMessages.getString("CMainTab.Workspace_settings_button_tooltip")); //$NON-NLS-1$ |
|
372 fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() { |
|
373 |
|
374 public void widgetSelected(SelectionEvent evt) { |
|
375 updateLaunchConfigurationDialog(); |
|
376 } |
|
377 }); |
|
378 |
|
379 fWorkpsaceSettingsLink = new Link(buildGroup, SWT.NONE); //$NON-NLS-1$ |
|
380 fWorkpsaceSettingsLink.setText(LaunchMessages.getString("CMainTab.Workspace_settings_link_label")); //$NON-NLS-1$ |
|
381 fWorkpsaceSettingsLink.addSelectionListener(new SelectionAdapter() { |
|
382 public void widgetSelected(SelectionEvent e) { |
|
383 PreferencesUtil.createPreferenceDialogOn( |
|
384 parent.getShell(), |
|
385 LaunchMessages.getString("CMainTab.Workspace_settings_page_id"), //$NON-NLS-1$ |
|
386 null, |
|
387 null).open(); |
|
388 } |
|
389 }); |
|
390 } |
323 /** @since 6.0 */ |
391 /** @since 6.0 */ |
324 protected void createCoreFileGroup(Composite parent, int colSpan) { |
392 protected void createCoreFileGroup(Composite parent, int colSpan) { |
325 Composite coreComp = new Composite(parent, SWT.NONE); |
393 Composite coreComp = new Composite(parent, SWT.NONE); |
326 GridLayout coreLayout = new GridLayout(); |
394 GridLayout coreLayout = new GridLayout(); |
327 coreLayout.numColumns = 3; |
395 coreLayout.numColumns = 3; |
393 public void initializeFrom(ILaunchConfiguration config) { |
461 public void initializeFrom(ILaunchConfiguration config) { |
394 filterPlatform = getPlatform(config); |
462 filterPlatform = getPlatform(config); |
395 updateProjectFromConfig(config); |
463 updateProjectFromConfig(config); |
396 updateProgramFromConfig(config); |
464 updateProgramFromConfig(config); |
397 updateCoreFromConfig(config); |
465 updateCoreFromConfig(config); |
|
466 updateBuildOptionFromConfig(config); |
398 updateTerminalFromConfig(config); |
467 updateTerminalFromConfig(config); |
399 } |
468 } |
400 |
469 |
401 protected void updateTerminalFromConfig(ILaunchConfiguration config) { |
470 protected void updateTerminalFromConfig(ILaunchConfiguration config) { |
402 if (fTerminalButton != null) { |
471 if (fTerminalButton != null) { |
422 fProjText.setText(projectName); |
491 fProjText.setText(projectName); |
423 updateBuildConfigCombo(configName); |
492 updateBuildConfigCombo(configName); |
424 } |
493 } |
425 |
494 |
426 protected void updateProgramFromConfig(ILaunchConfiguration config) { |
495 protected void updateProgramFromConfig(ILaunchConfiguration config) { |
427 String programName = EMPTY_STRING; |
496 if (fProgText != null) |
428 try { |
497 { |
429 programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING); |
498 String programName = EMPTY_STRING; |
430 } catch (CoreException ce) { |
499 try { |
431 LaunchUIPlugin.log(ce); |
500 programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING); |
432 } |
501 } catch (CoreException ce) { |
433 fProgText.setText(programName); |
502 LaunchUIPlugin.log(ce); |
|
503 } |
|
504 fProgText.setText(programName); |
|
505 } |
434 } |
506 } |
435 |
507 |
436 /** @since 6.0 */ |
508 /** @since 6.0 */ |
437 protected void updateCoreFromConfig(ILaunchConfiguration config) { |
509 protected void updateCoreFromConfig(ILaunchConfiguration config) { |
438 if (fCoreText != null) { |
510 if (fCoreText != null) { |
440 try { |
512 try { |
441 coreName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING); |
513 coreName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING); |
442 } catch (CoreException ce) { |
514 } catch (CoreException ce) { |
443 LaunchUIPlugin.log(ce); |
515 LaunchUIPlugin.log(ce); |
444 } |
516 } |
445 fCoreText.setText(coreName); |
517 fProgText.setText(coreName); |
446 } |
518 } |
447 } |
519 } |
448 |
520 |
|
521 protected void updateBuildOptionFromConfig(ILaunchConfiguration config) { |
|
522 int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING; |
|
523 try { |
|
524 buildBeforeLaunchValue = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue); |
|
525 } catch (CoreException e) { |
|
526 LaunchUIPlugin.log(e); |
|
527 } |
|
528 |
|
529 fDisableBuildButton.setSelection(buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED); |
|
530 fEnableBuildButton.setSelection(buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED); |
|
531 fWorkspaceSettingsButton.setSelection(buildBeforeLaunchValue == ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING); |
|
532 } |
|
533 |
449 /* |
534 /* |
450 * (non-Javadoc) |
535 * (non-Javadoc) |
451 * |
536 * |
452 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) |
537 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) |
453 */ |
538 */ |
462 // the user typed in a non-existent project name. Ensure that |
547 // the user typed in a non-existent project name. Ensure that |
463 // won't be suppressed from the dialog. This matches JDT behaviour |
548 // won't be suppressed from the dialog. This matches JDT behaviour |
464 config.setMappedResources(null); |
549 config.setMappedResources(null); |
465 } |
550 } |
466 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText()); |
551 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText()); |
467 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex()))); |
552 if (fBuildConfigCombo != null) { |
468 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText()); |
553 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex()))); |
|
554 } |
|
555 if (fProgText != null) { |
|
556 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText()); |
|
557 } |
469 if (fCoreText != null) { |
558 if (fCoreText != null) { |
470 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, fCoreText.getText()); |
559 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, fCoreText.getText()); |
471 } |
560 } |
472 if (fTerminalButton != null) { |
561 if (fTerminalButton != null) { |
473 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, fTerminalButton.getSelection()); |
562 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, fTerminalButton.getSelection()); |
|
563 } |
|
564 |
|
565 if (fDisableBuildButton != null) { |
|
566 int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING; |
|
567 if (fDisableBuildButton.getSelection()) { |
|
568 buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED; |
|
569 } else if (fEnableBuildButton.getSelection()) { |
|
570 buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED; |
|
571 } |
|
572 config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue); |
474 } |
573 } |
475 } |
574 } |
476 |
575 |
477 /** |
576 /** |
478 * Show a dialog that lists all main types |
577 * Show a dialog that lists all main types |