| 1 |
/******************************************************************************* |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
* which accompanies this distribution, and is available at |
| 18 |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| 19 |
import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds; |
import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds; |
| 20 |
import org.eclipse.jdt.internal.debug.ui.JavaDebugImages; |
import org.eclipse.jdt.internal.debug.ui.JavaDebugImages; |
| 21 |
|
import org.eclipse.jdt.internal.debug.ui.SWTFactory; |
| 22 |
import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages; |
import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages; |
| 23 |
import org.eclipse.jdt.internal.debug.ui.launcher.NameValuePairDialog; |
import org.eclipse.jdt.internal.debug.ui.launcher.NameValuePairDialog; |
| 24 |
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
| 42 |
import org.eclipse.swt.events.SelectionEvent; |
import org.eclipse.swt.events.SelectionEvent; |
| 43 |
import org.eclipse.swt.graphics.Image; |
import org.eclipse.swt.graphics.Image; |
| 44 |
import org.eclipse.swt.layout.GridData; |
import org.eclipse.swt.layout.GridData; |
|
import org.eclipse.swt.layout.GridLayout; |
|
| 45 |
import org.eclipse.swt.widgets.Button; |
import org.eclipse.swt.widgets.Button; |
| 46 |
import org.eclipse.swt.widgets.Composite; |
import org.eclipse.swt.widgets.Composite; |
| 47 |
import org.eclipse.swt.widgets.Label; |
import org.eclipse.swt.widgets.Label; |
| 61 |
*/ |
*/ |
| 62 |
public class AppletParametersTab extends JavaLaunchTab { |
public class AppletParametersTab extends JavaLaunchTab { |
| 63 |
|
|
|
private Label fWidthLabel; |
|
| 64 |
private Text fWidthText; |
private Text fWidthText; |
|
private Label fHeightLabel; |
|
| 65 |
private Text fHeightText; |
private Text fHeightText; |
|
private Label fNameLabel; |
|
| 66 |
private Text fNameText; |
private Text fNameText; |
| 67 |
private Button fParametersAddButton; |
private Button fParametersAddButton; |
| 68 |
private Button fParametersRemoveButton; |
private Button fParametersRemoveButton; |
| 118 |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite) |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite) |
| 119 |
*/ |
*/ |
| 120 |
public void createControl(Composite parent) { |
public void createControl(Composite parent) { |
| 121 |
Composite comp = new Composite(parent, SWT.NONE); |
Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_HORIZONTAL); |
| 122 |
setControl(comp); |
setControl(comp); |
| 123 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_APPLET_PARAMETERS_TAB); |
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_APPLET_PARAMETERS_TAB); |
| 124 |
GridLayout topLayout = new GridLayout(); |
|
| 125 |
comp.setLayout(topLayout); |
Composite namecomp = SWTFactory.createComposite(comp, comp.getFont(), 4, 1, GridData.FILL_HORIZONTAL, 0, 0); |
| 126 |
GridData gd; |
|
| 127 |
|
SWTFactory.createLabel(namecomp, LauncherMessages.appletlauncher_argumenttab_widthlabel_text, 1); |
| 128 |
Composite widthHeightNameComp = new Composite(comp, SWT.NONE); |
|
| 129 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
fWidthText = SWTFactory.createSingleText(namecomp, 1); |
|
widthHeightNameComp.setLayoutData(gd); |
|
|
GridLayout widthHeightNameLayout = new GridLayout(); |
|
|
widthHeightNameLayout.marginHeight = 0; |
|
|
widthHeightNameLayout.marginWidth = 0; |
|
|
widthHeightNameLayout.numColumns = 4; |
|
|
widthHeightNameComp.setLayout(widthHeightNameLayout); |
|
|
|
|
|
fWidthLabel= new Label(widthHeightNameComp, SWT.NONE); |
|
|
fWidthLabel.setText(LauncherMessages.appletlauncher_argumenttab_widthlabel_text); |
|
|
|
|
|
fWidthText = new Text(widthHeightNameComp, SWT.SINGLE | SWT.BORDER); |
|
|
gd = new GridData(GridData.FILL_HORIZONTAL); |
|
|
fWidthText.setLayoutData(gd); |
|
| 130 |
fWidthText.addModifyListener(fListener); |
fWidthText.addModifyListener(fListener); |
| 131 |
|
|
| 132 |
fNameLabel = new Label(widthHeightNameComp, SWT.NONE); |
SWTFactory.createLabel(namecomp, LauncherMessages.appletlauncher_argumenttab_namelabel_text, 1); |
|
fNameLabel.setText(LauncherMessages.appletlauncher_argumenttab_namelabel_text); |
|
| 133 |
|
|
| 134 |
fNameText = new Text(widthHeightNameComp, SWT.SINGLE | SWT.BORDER); |
fNameText = SWTFactory.createSingleText(namecomp, 1); |
|
gd = new GridData(GridData.FILL_HORIZONTAL); |
|
|
fNameText.setLayoutData(gd); |
|
| 135 |
fNameText.addModifyListener(fListener); |
fNameText.addModifyListener(fListener); |
| 136 |
|
|
| 137 |
fHeightLabel= new Label(widthHeightNameComp, SWT.NONE); |
SWTFactory.createLabel(namecomp, LauncherMessages.appletlauncher_argumenttab_heightlabel_text, 1); |
|
fHeightLabel.setText(LauncherMessages.appletlauncher_argumenttab_heightlabel_text); |
|
| 138 |
|
|
| 139 |
fHeightText = new Text(widthHeightNameComp, SWT.SINGLE | SWT.BORDER); |
fHeightText = SWTFactory.createSingleText(namecomp, 1); |
|
gd = new GridData(GridData.FILL_HORIZONTAL); |
|
|
fHeightText.setLayoutData(gd); |
|
| 140 |
fHeightText.addModifyListener(fListener); |
fHeightText.addModifyListener(fListener); |
| 141 |
|
|
| 142 |
Label blank = new Label(widthHeightNameComp, SWT.NONE); |
Label blank = new Label(namecomp, SWT.NONE); |
| 143 |
blank.setText(EMPTY_STRING); |
blank.setText(EMPTY_STRING); |
| 144 |
Label hint = new Label(widthHeightNameComp, SWT.NONE); |
Label hint = SWTFactory.createLabel(namecomp, LauncherMessages.AppletParametersTab__optional_applet_instance_name__1, 1); |
| 145 |
hint.setText(LauncherMessages.AppletParametersTab__optional_applet_instance_name__1); |
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); |
|
gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); |
|
| 146 |
hint.setLayoutData(gd); |
hint.setLayoutData(gd); |
| 147 |
|
|
| 148 |
createVerticalSpacer(comp); |
SWTFactory.createVerticalSpacer(comp, 1); |
| 149 |
|
|
| 150 |
Composite parametersComp = new Composite(comp, SWT.NONE); |
Composite paramcomp = SWTFactory.createComposite(comp, comp.getFont(), 2, 1, GridData.FILL_BOTH, 0, 0); |
|
gd = new GridData(GridData.FILL_BOTH); |
|
|
parametersComp.setLayoutData(gd); |
|
|
GridLayout parametersLayout = new GridLayout(); |
|
|
parametersLayout.numColumns = 2; |
|
|
parametersLayout.marginHeight = 0; |
|
|
parametersLayout.marginWidth = 0; |
|
|
parametersComp.setLayout(parametersLayout); |
|
|
|
|
|
Label parameterLabel = new Label(parametersComp, SWT.NONE); |
|
|
parameterLabel.setText(LauncherMessages.appletlauncher_argumenttab_parameterslabel_text); |
|
|
gd = new GridData(); |
|
|
gd.horizontalSpan = 2; |
|
|
parameterLabel.setLayoutData(gd); |
|
| 151 |
|
|
| 152 |
|
SWTFactory.createLabel(paramcomp, LauncherMessages.appletlauncher_argumenttab_parameterslabel_text, 2); |
| 153 |
|
|
| 154 |
fViewer = new TableViewer(parametersComp); |
Table ptable = new Table(paramcomp, SWT.FULL_SELECTION | SWT.BORDER); |
| 155 |
Table parametersTable = fViewer.getTable(); |
fViewer = new TableViewer(ptable); |
| 156 |
gd = new GridData(GridData.FILL_BOTH); |
gd = new GridData(GridData.FILL_BOTH); |
| 157 |
parametersTable.setLayoutData(gd); |
ptable.setLayoutData(gd); |
| 158 |
TableColumn column1 = new TableColumn(parametersTable, SWT.NONE); |
TableColumn column1 = new TableColumn(ptable, SWT.NONE); |
| 159 |
column1.setText(LauncherMessages.appletlauncher_argumenttab_parameterscolumn_name_text); |
column1.setText(LauncherMessages.appletlauncher_argumenttab_parameterscolumn_name_text); |
| 160 |
TableColumn column2 = new TableColumn(parametersTable, SWT.NONE); |
TableColumn column2 = new TableColumn(ptable, SWT.NONE); |
| 161 |
column2.setText(LauncherMessages.appletlauncher_argumenttab_parameterscolumn_value_text); |
column2.setText(LauncherMessages.appletlauncher_argumenttab_parameterscolumn_value_text); |
| 162 |
TableLayout tableLayout = new TableLayout(); |
TableLayout tableLayout = new TableLayout(); |
| 163 |
parametersTable.setLayout(tableLayout); |
ptable.setLayout(tableLayout); |
| 164 |
tableLayout.addColumnData(new ColumnWeightData(100)); |
tableLayout.addColumnData(new ColumnWeightData(100)); |
| 165 |
tableLayout.addColumnData(new ColumnWeightData(100)); |
tableLayout.addColumnData(new ColumnWeightData(100)); |
| 166 |
parametersTable.setHeaderVisible(true); |
ptable.setHeaderVisible(true); |
| 167 |
parametersTable.setLinesVisible(true); |
ptable.setLinesVisible(true); |
| 168 |
parametersTable.addSelectionListener(fListener); |
ptable.addSelectionListener(fListener); |
| 169 |
parametersTable.addMouseListener(new MouseAdapter() { |
ptable.addMouseListener(new MouseAdapter() { |
| 170 |
public void mouseDoubleClick(MouseEvent e) { |
public void mouseDoubleClick(MouseEvent e) { |
| 171 |
setParametersButtonsEnableState(); |
setParametersButtonsEnableState(); |
| 172 |
if (fParametersEditButton.isEnabled()) { |
if (fParametersEditButton.isEnabled()) { |
| 215 |
|
|
| 216 |
fViewer.setComparator(new ViewerComparator()); |
fViewer.setComparator(new ViewerComparator()); |
| 217 |
|
|
| 218 |
Composite envButtonComp = new Composite(parametersComp, SWT.NONE); |
Composite envcomp = SWTFactory.createComposite(paramcomp, paramcomp.getFont(), 1, 1, GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL, 0, 0); |
|
GridLayout envButtonLayout = new GridLayout(); |
|
|
envButtonLayout.marginHeight = 0; |
|
|
envButtonLayout.marginWidth = 0; |
|
|
envButtonComp.setLayout(envButtonLayout); |
|
|
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); |
|
|
envButtonComp.setLayoutData(gd); |
|
| 219 |
|
|
| 220 |
fParametersAddButton = createPushButton(envButtonComp ,LauncherMessages.appletlauncher_argumenttab_parameters_button_add_text, null); |
fParametersAddButton = createPushButton(envcomp ,LauncherMessages.appletlauncher_argumenttab_parameters_button_add_text, null); |
| 221 |
fParametersAddButton.addSelectionListener(fListener); |
fParametersAddButton.addSelectionListener(fListener); |
| 222 |
|
|
| 223 |
fParametersEditButton = createPushButton(envButtonComp, LauncherMessages.appletlauncher_argumenttab_parameters_button_edit_text, null); |
fParametersEditButton = createPushButton(envcomp, LauncherMessages.appletlauncher_argumenttab_parameters_button_edit_text, null); |
| 224 |
fParametersEditButton.addSelectionListener(fListener); |
fParametersEditButton.addSelectionListener(fListener); |
| 225 |
|
|
| 226 |
fParametersRemoveButton = createPushButton(envButtonComp, LauncherMessages.appletlauncher_argumenttab_parameters_button_remove_text, null); |
fParametersRemoveButton = createPushButton(envcomp, LauncherMessages.appletlauncher_argumenttab_parameters_button_remove_text, null); |
| 227 |
fParametersRemoveButton.addSelectionListener(fListener); |
fParametersRemoveButton.addSelectionListener(fListener); |
| 228 |
|
|
| 229 |
|
setParametersButtonsEnableState(); |
| 230 |
Dialog.applyDialogFont(parent); |
Dialog.applyDialogFont(parent); |
| 231 |
} |
} |
| 232 |
|
|
| 399 |
} |
} |
| 400 |
|
|
| 401 |
/** |
/** |
|
* Create some empty space |
|
|
*/ |
|
|
private void createVerticalSpacer(Composite comp) { |
|
|
new Label(comp, SWT.NONE); |
|
|
} |
|
|
|
|
|
/** |
|
| 402 |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() |
| 403 |
*/ |
*/ |
| 404 |
public String getName() { |
public String getName() { |
| 432 |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) |
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) |
| 433 |
*/ |
*/ |
| 434 |
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { |
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { |
| 435 |
// do nothing when deactivated |
// do nothing when de-activated |
| 436 |
} |
} |
| 437 |
} |
} |
| 438 |
|
|