1 11 package org.eclipse.ant.internal.ui.launchConfigurations; 12 13 import org.eclipse.ant.internal.ui.AntUIPlugin; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 16 import org.eclipse.jface.dialogs.Dialog; 17 import org.eclipse.jface.dialogs.IDialogSettings; 18 import org.eclipse.swt.SWT; 19 import org.eclipse.swt.widgets.Composite; 20 import org.eclipse.swt.widgets.Control; 21 import org.eclipse.swt.widgets.Shell; 22 23 public class SetTargetsDialog extends Dialog { 24 25 private static String DIALOG_SETTINGS_SECTION = "SetTargetsDialogSettings"; 27 private ILaunchConfigurationWorkingCopy fConfiguration; 28 private AntTargetsTab fTargetsTab; 29 30 public SetTargetsDialog(Shell parentShell, ILaunchConfigurationWorkingCopy config) { 31 super(parentShell); 32 setShellStyle(SWT.RESIZE | getShellStyle()); 33 fConfiguration= config; 34 } 35 36 39 protected Control createDialogArea(Composite parent) { 40 41 getShell().setText(AntLaunchConfigurationMessages.SetTargetsDialog_0); 42 Composite composite = (Composite)super.createDialogArea(parent); 43 44 fTargetsTab= new AntTargetsTab(); 45 fTargetsTab.createControl(composite); 46 fTargetsTab.initializeFrom(fConfiguration); 47 applyDialogFont(composite); 48 return composite; 49 } 50 51 54 protected void okPressed() { 55 fTargetsTab.performApply(fConfiguration); 56 57 super.okPressed(); 58 } 59 60 protected String getTargetsSelected() { 61 String defaultValue= null; 62 if (!fTargetsTab.isTargetSelected()) { 63 defaultValue= ""; } 65 try { 66 return fConfiguration.getAttribute(IAntLaunchConfigurationConstants.ATTR_ANT_TARGETS, defaultValue); 67 } catch (CoreException e) { 68 return defaultValue; 69 } 70 } 71 72 75 protected IDialogSettings getDialogBoundsSettings() { 76 IDialogSettings settings = AntUIPlugin.getDefault().getDialogSettings(); 77 IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION); 78 if (section == null) { 79 section = settings.addNewSection(DIALOG_SETTINGS_SECTION); 80 } 81 return section; 82 } 83 } 84 85 | Popular Tags |