1 11 package org.eclipse.pde.ui.launcher; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.debug.core.ILaunchConfiguration; 15 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 16 import org.eclipse.jface.dialogs.Dialog; 17 import org.eclipse.pde.internal.ui.IHelpContextIds; 18 import org.eclipse.pde.internal.ui.PDEPluginImages; 19 import org.eclipse.pde.internal.ui.PDEUIMessages; 20 import org.eclipse.pde.internal.ui.launcher.ConfigurationAreaBlock; 21 import org.eclipse.pde.internal.ui.launcher.ConfigurationTemplateBlock; 22 import org.eclipse.swt.SWT; 23 import org.eclipse.swt.graphics.Image; 24 import org.eclipse.swt.layout.GridData; 25 import org.eclipse.swt.layout.GridLayout; 26 import org.eclipse.swt.widgets.Composite; 27 import org.eclipse.ui.PlatformUI; 28 29 37 public class ConfigurationTab extends AbstractLauncherTab implements IPDELauncherConstants { 38 39 private ConfigurationAreaBlock fConfigurationArea; 40 private ConfigurationTemplateBlock fTemplateArea; 41 private Image fImage; 42 private boolean fJUnitConfig; 43 44 49 public ConfigurationTab() { 50 this(false); 51 } 52 53 58 public ConfigurationTab(boolean isJUnitConfig) { 59 fImage = PDEPluginImages.DESC_SETTINGS_OBJ.createImage(); 60 fConfigurationArea = new ConfigurationAreaBlock(this); 61 fTemplateArea = new ConfigurationTemplateBlock(this); 62 fJUnitConfig = isJUnitConfig; 63 } 64 65 69 public void createControl(Composite parent) { 70 Composite container = new Composite(parent, SWT.NONE); 71 container.setLayout(new GridLayout()); 72 container.setLayoutData(new GridData(GridData.FILL_BOTH)); 73 74 fConfigurationArea.createControl(container); 75 fTemplateArea.createControl(container); 76 77 Dialog.applyDialogFont(container); 78 setControl(container); 79 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.LAUNCHER_CONFIGURATION); 80 } 81 82 85 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { 86 fConfigurationArea.setDefaults(configuration, fJUnitConfig); 87 fTemplateArea.setDefaults(configuration); 88 } 89 90 93 public void initializeFrom(ILaunchConfiguration configuration) { 94 try { 95 fConfigurationArea.initializeFrom(configuration); 96 fTemplateArea.initializeFrom(configuration); 97 } catch (CoreException e) { 98 } 99 } 100 101 105 public void performApply(ILaunchConfigurationWorkingCopy configuration) { 106 fConfigurationArea.performApply(configuration); 107 fTemplateArea.performApply(configuration); 108 } 109 110 114 public String getName() { 115 return PDEUIMessages.ConfigurationTab_name; 116 } 117 118 122 public Image getImage() { 123 return fImage; 124 } 125 126 130 public void dispose() { 131 if (fImage != null) 132 fImage.dispose(); 133 } 134 135 141 public void validateTab() { 142 String error = fConfigurationArea.validate(); 143 if (error == null) 144 error = fTemplateArea.validate(); 145 setErrorMessage(error); 146 } 147 } 148 | Popular Tags |