1 11 package org.eclipse.debug.internal.ui.launchConfigurations; 12 13 import org.eclipse.debug.core.ILaunchConfiguration; 14 import org.eclipse.debug.ui.IDebugUIConstants; 15 import org.eclipse.jface.dialogs.IDialogConstants; 16 import org.eclipse.swt.widgets.Composite; 17 import org.eclipse.swt.widgets.Shell; 18 19 25 public class LaunchConfigurationEditDialog extends LaunchConfigurationDialog { 26 27 private boolean fShowCancel = false; 28 29 36 public LaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration launchConfiguration, LaunchGroupExtension group, boolean showcancel) { 37 super(shell, launchConfiguration, group); 38 fShowCancel = showcancel; 39 } 40 41 44 protected String getTitleAreaTitle() { 45 return LaunchConfigurationsMessages.LaunchConfigurationEditDialog_0; 46 } 47 48 51 protected void createButtonsForButtonBar(Composite parent) { 52 createButton(parent, ID_LAUNCH_BUTTON, LaunchConfigurationsMessages.LaunchConfigurationEditDialog_1, true); 53 if(fShowCancel) { 54 createButton(parent, ID_CANCEL_BUTTON, IDialogConstants.CANCEL_LABEL, false); 55 } 56 } 57 58 61 public void updateButtons() { 62 getTabViewer().refresh(); 63 getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithModes() & !getTabViewer().hasDuplicateDelegates()); 64 } 65 66 69 protected String getDialogSettingsSectionName() { 70 return IDebugUIConstants.PLUGIN_ID + ".LAUNCH_CONFIGURATION_EDIT_DIALOG_SECTION"; } 72 73 76 protected void buttonPressed(int buttonId) { 77 if(buttonId == ID_LAUNCH_BUTTON) { 78 setReturnCode(IDialogConstants.OK_ID); 79 int status = shouldSaveCurrentConfig(); 80 if(status != IDialogConstants.CANCEL_ID) { 81 if(status != ID_DISCARD_BUTTON) { 82 if(status == IDialogConstants.YES_ID) { 83 getTabViewer().handleApplyPressed(); 84 } 85 } 86 } 87 } 88 else if(buttonId == ID_CANCEL_BUTTON) { 89 setReturnCode(IDialogConstants.CANCEL_ID); 90 } 91 close(); 92 } 93 } 94 | Popular Tags |