1 11 package org.eclipse.ant.internal.ui.launchConfigurations; 12 13 import org.eclipse.ant.internal.ui.AntUtil; 14 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 15 import org.eclipse.debug.ui.EnvironmentTab; 16 import org.eclipse.jface.dialogs.Dialog; 17 import org.eclipse.swt.SWT; 18 import org.eclipse.swt.graphics.Color; 19 import org.eclipse.swt.layout.GridData; 20 import org.eclipse.swt.layout.GridLayout; 21 import org.eclipse.swt.widgets.Composite; 22 import org.eclipse.swt.widgets.Display; 23 import org.eclipse.swt.widgets.Label; 24 import org.eclipse.swt.widgets.Table; 25 26 33 public class AntEnvironmentTab extends EnvironmentTab { 34 35 protected Composite wrappingComposite; 36 protected Label warningLabel; 37 38 public void createControl(Composite parent) { 39 wrappingComposite= new Composite(parent, SWT.NONE); 40 wrappingComposite.setLayout(new GridLayout()); 41 wrappingComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); 42 wrappingComposite.setFont(parent.getFont()); 43 44 warningLabel= new Label(wrappingComposite, SWT.NONE); 45 warningLabel.setText(AntLaunchConfigurationMessages.AntEnvironmentTab_0); 46 47 super.createControl(wrappingComposite); 48 setControl(wrappingComposite); Dialog.applyDialogFont(parent); 50 } 51 52 55 public void activated(ILaunchConfigurationWorkingCopy workingCopy) { 56 updateWidgetsEnabled(workingCopy); 57 } 58 59 protected void updateWidgetsEnabled(ILaunchConfigurationWorkingCopy workingCopy) { 60 if (wrappingComposite == null) { 61 return; 62 } 63 boolean isSeparateJREBuild= AntUtil.isSeparateJREAntBuild(workingCopy); 64 65 Color tableColor= isSeparateJREBuild ? null : Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); 66 Color labelColor= isSeparateJREBuild ? null : Display.getDefault().getSystemColor(SWT.COLOR_RED); 67 Table table = environmentTable.getTable(); 68 table.setEnabled(isSeparateJREBuild); 69 table.setBackground(tableColor); 70 warningLabel.setForeground(labelColor); 71 envAddButton.setEnabled(isSeparateJREBuild); 72 envSelectButton.setEnabled(isSeparateJREBuild); 73 updateAppendReplace(); 74 environmentTable.setSelection(environmentTable.getSelection()); 76 } 77 } 78 | Popular Tags |