use of org.eclipse.wst.xsl.internal.debug.ui.actions.AddParameterAction in project webtools.sourceediting by eclipse.
the class ParametersBlock method createControl.
public void createControl(Composite parent) {
Font font = parent.getFont();
Group group = new Group(parent, SWT.NONE);
group.setText(getName());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
group.setLayoutData(gd);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
group.setLayout(layout);
group.setFont(font);
setControl(group);
fTable = new Table(group, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
// data.heightHint = 100;
fTable.setLayoutData(data);
fTable.setFont(font);
fTable.setHeaderVisible(true);
fTable.setLinesVisible(true);
TableColumn column1 = new TableColumn(fTable, SWT.NONE);
column1.setWidth(150);
column1.setResizable(true);
column1.setText(Messages.ParametersBlock_0);
TableColumn column3 = new TableColumn(fTable, SWT.NONE);
column3.setWidth(250);
column3.setResizable(true);
column3.setText(Messages.ParametersBlock_2);
parametersViewer = new ParameterViewer(fTable);
parametersViewer.getViewer().setLabelProvider(new ParametersLabelProvider());
parametersViewer.getViewer().setContentProvider(new ParametersContentProvider());
parametersViewer.addParametersChangedListener(new IParametersChangedListener() {
public void parametersChanged(ParameterViewer viewer) {
updateLaunchConfigurationDialog();
}
});
parametersViewer.getViewer().getTable().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent event) {
if (event.character == SWT.DEL && event.stateMask == 0) {
RemoveParameterAction ra = new RemoveParameterAction(parametersViewer);
ra.run();
updateLaunchConfigurationDialog();
}
}
});
parametersViewer.getViewer().setColumnProperties(// $NON-NLS-1$ //$NON-NLS-2$
new String[] { "name", "value" });
TextCellEditor textEditor = new TextCellEditor(fTable);
CellEditor[] editors = new CellEditor[] { null, textEditor };
parametersViewer.getViewer().setCellEditors(editors);
parametersViewer.getViewer().setCellModifier(new ICellModifier() {
public boolean canModify(Object element, String property) {
// $NON-NLS-1$
return "value".equals(property);
}
public Object getValue(Object element, String property) {
LaunchAttribute att = (LaunchAttribute) element;
// $NON-NLS-1$
return att.value == null ? "" : att.value;
}
public void modify(Object element, String property, Object value) {
Item item = (Item) element;
LaunchAttribute att = (LaunchAttribute) item.getData();
att.value = (String) value;
parametersViewer.getViewer().update(att, null);
updateLaunchConfigurationDialog();
}
});
Composite parameterButtonComp = new Composite(group, SWT.NONE);
GridLayout parameterButtonCompLayout = new GridLayout();
parameterButtonCompLayout.marginHeight = 0;
parameterButtonCompLayout.marginWidth = 0;
parameterButtonComp.setLayout(parameterButtonCompLayout);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
parameterButtonComp.setLayoutData(gd);
parameterButtonComp.setFont(font);
addParameterButton = createButton(parameterButtonComp, new AddParameterAction(parametersViewer));
removeParameterButton = createButton(parameterButtonComp, new RemoveParameterAction(parametersViewer));
transformsBlock.getStylesheetViewer().addSelectionChangedListener(selectionListener);
restoreColumnSettings();
}
Aggregations