1 11 package org.eclipse.debug.ui; 12 13 14 import org.eclipse.debug.core.DebugPlugin; 15 import org.eclipse.debug.core.ILaunch; 16 import org.eclipse.debug.core.ILaunchConfiguration; 17 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 18 import org.eclipse.debug.core.ILaunchManager; 19 import org.eclipse.debug.internal.ui.SWTFactory; 20 import org.eclipse.swt.SWT; 21 import org.eclipse.swt.graphics.Image; 22 import org.eclipse.swt.layout.GridData; 23 import org.eclipse.swt.widgets.Button; 24 import org.eclipse.swt.widgets.Composite; 25 import org.eclipse.swt.widgets.Control; 26 import org.eclipse.swt.widgets.Label; 27 import org.eclipse.swt.widgets.Shell; 28 29 37 public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigurationTab { 38 40 43 private Control fControl; 44 45 49 private ILaunchConfigurationDialog fLaunchConfigurationDialog; 50 51 54 private String fErrorMessage; 55 56 59 private String fMessage; 60 61 69 private boolean fDirty = true; 70 71 77 protected ILaunchConfigurationDialog getLaunchConfigurationDialog() { 78 return fLaunchConfigurationDialog; 79 } 80 81 85 protected void updateLaunchConfigurationDialog() { 86 if (getLaunchConfigurationDialog() != null) { 87 getLaunchConfigurationDialog().updateButtons(); 91 getLaunchConfigurationDialog().updateMessage(); 92 } 93 } 94 95 98 public Control getControl() { 99 return fControl; 100 } 101 102 107 protected void setControl(Control control) { 108 fControl = control; 109 } 110 111 114 public String getErrorMessage() { 115 return fErrorMessage; 116 } 117 118 121 public String getMessage() { 122 return fMessage; 123 } 124 125 131 public void launched(ILaunch launch) { 132 } 133 134 137 public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) { 138 fLaunchConfigurationDialog = dialog; 139 } 140 141 146 protected void setErrorMessage(String errorMessage) { 147 fErrorMessage = errorMessage; 148 } 149 150 155 protected void setMessage(String message) { 156 fMessage = message; 157 } 158 159 164 protected ILaunchManager getLaunchManager() { 165 return DebugPlugin.getDefault().getLaunchManager(); 166 } 167 168 173 public void dispose() { 174 } 175 176 181 protected Shell getShell() { 182 Control control = getControl(); 183 if (control != null) { 184 return control.getShell(); 185 } 186 return null; 187 } 188 189 199 protected Button createPushButton(Composite parent, String label, Image image) { 200 return SWTFactory.createPushButton(parent, label, image); 201 } 202 203 212 protected Button createRadioButton(Composite parent, String label) { 213 return SWTFactory.createRadioButton(parent, label); 214 } 215 216 225 protected Button createCheckButton(Composite parent, String label) { 226 Button button = new Button(parent, SWT.CHECK); 227 button.setText(label); 228 GridData data = new GridData(); 229 button.setLayoutData(data); 230 button.setFont(parent.getFont()); 231 SWTFactory.setButtonDimensionHint(button); 232 return button; 233 } 234 235 238 public boolean canSave() { 239 return true; 240 } 241 242 245 public boolean isValid(ILaunchConfiguration launchConfig) { 246 return true; 247 } 248 249 254 protected void createVerticalSpacer(Composite comp, int colSpan) { 255 Label label = new Label(comp, SWT.NONE); 256 GridData gd = new GridData(); 257 gd.horizontalSpan = colSpan; 258 label.setLayoutData(gd); 259 label.setFont(comp.getFont()); 260 } 261 262 269 protected void createSeparator(Composite comp, int colSpan) { 270 Label label = new Label(comp, SWT.SEPARATOR | SWT.HORIZONTAL); 271 GridData gd = new GridData(GridData.FILL_HORIZONTAL); 272 gd.horizontalSpan = colSpan; 273 label.setLayoutData(gd); 274 } 275 276 279 public Image getImage() { 280 return null; 281 } 282 283 294 public String getId() { 295 return null; 296 } 297 298 309 protected void setAttribute(String attribute, ILaunchConfigurationWorkingCopy configuration, boolean value, boolean defaultValue) { 310 if (value == defaultValue) { 311 configuration.setAttribute(attribute, (String )null); 312 } else { 313 configuration.setAttribute(attribute, value); 314 } 315 } 316 317 318 319 326 protected boolean isDirty() { 327 return fDirty; 328 } 329 330 337 protected void setDirty(boolean dirty) { 338 fDirty = dirty; 339 } 340 341 359 public void activated(ILaunchConfigurationWorkingCopy workingCopy) { 360 initializeFrom(workingCopy); 361 } 362 363 379 public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { 380 performApply(workingCopy); 381 } 382 383 } 384 385 | Popular Tags |