use of org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter in project titan.EclipsePlug-ins by eclipse.
the class ModuleParameterSectionDragSourceListener method dragStart.
@Override
public void dragStart(final DragSourceEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
event.doit = !selection.isEmpty() && (selection.getFirstElement() instanceof ModuleParameter);
}
use of org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter in project titan.EclipsePlug-ins by eclipse.
the class ModuleParameterSectionPage method createNewParameter.
public static ModuleParameter createNewParameter(final String aModuleName, final String aParameterName, final String aValue) {
ModuleParameter newModuleParameter = new ModuleParameterSectionHandler.ModuleParameter();
final ParseTree root = new ParserRuleContext();
newModuleParameter.setRoot(root);
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("\n"));
newModuleParameter.setModuleName(new AddedParseTree(aModuleName));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getModuleName());
final boolean isModuleNameEmpty = aModuleName == null || aModuleName.isEmpty();
newModuleParameter.setSeparator(new AddedParseTree(isModuleNameEmpty ? "" : "."));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getSeparator());
newModuleParameter.setParameterName(new AddedParseTree(aParameterName));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getParameterName());
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(" := "));
newModuleParameter.setValue(new AddedParseTree(aValue));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getValue());
return newModuleParameter;
}
use of org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter in project titan.EclipsePlug-ins by eclipse.
the class ModuleParameterSectionPage method createDetailsPart.
private void createDetailsPart(final Composite parent, final ScrolledForm form, final FormToolkit toolkit) {
Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
section.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
section.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
Composite client = toolkit.createComposite(section, SWT.WRAP);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
client.setLayout(layout);
parameterValueText = toolkit.createText(client, "", SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
parameterValueText.setLayoutData(new GridData(GridData.FILL_BOTH));
parameterValueText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
StructuredSelection selection = (StructuredSelection) moduleParametersTableViewer.getSelection();
Iterator<?> iterator = selection.iterator();
if (!iterator.hasNext()) {
return;
}
ModuleParameter moduleParameter = (ModuleParameter) iterator.next();
ConfigTreeNodeUtilities.setText(moduleParameter.getValue(), parameterValueText.getText());
if (valueChanged) {
valueChanged = false;
return;
}
editor.setDirty();
}
});
parameterValueText.setEnabled(moduleParametersHandler != null);
section.setText("Module parameter value");
section.setDescription("Specify the concrete value for the actually selected module parameter.");
section.setClient(client);
section.setExpanded(true);
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
form.reflow(false);
}
});
GridData gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessVerticalSpace = true;
section.setLayoutData(gd);
}
use of org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter in project titan.EclipsePlug-ins by eclipse.
the class ModuleParameterSectionPage method removeSelectedParameters.
public void removeSelectedParameters() {
if (moduleParametersTableViewer == null || moduleParametersHandler == null) {
return;
}
StructuredSelection selection = (StructuredSelection) moduleParametersTableViewer.getSelection();
Iterator<?> iterator = selection.iterator();
// remove the selected elements
for (; iterator.hasNext(); ) {
ModuleParameter moduleParameter = (ModuleParameter) iterator.next();
if (moduleParameter != null) {
ConfigTreeNodeUtilities.removeChild(moduleParametersHandler.getLastSectionRoot(), moduleParameter.getRoot());
moduleParametersHandler.getModuleParameters().remove(moduleParameter);
}
}
moduleParametersTableViewer.setSelection(null);
}
Aggregations