use of org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler.TestportParameter in project titan.EclipsePlug-ins by eclipse.
the class TestportParameterSectionDragSourceListener method dragSetData.
@Override
public void dragSetData(final DragSourceEvent event) {
if (TestportParameterTransfer.getInstance().isSupportedType(event.dataType)) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
List<TestportParameter> items = new ArrayList<TestportParameter>();
if (!selection.isEmpty()) {
for (Iterator<?> it = selection.iterator(); it.hasNext(); ) {
Object element = it.next();
if (element instanceof TestportParameter) {
items.add((TestportParameter) element);
}
}
event.data = items.toArray(new TestportParameter[items.size()]);
}
}
}
use of org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler.TestportParameter in project titan.EclipsePlug-ins by eclipse.
the class TestportParameterSectionDropTargetListener method drop.
@Override
public void drop(final DropTargetEvent event) {
if (TestportParameterTransfer.getInstance().isSupportedType(event.currentDataType)) {
if (event.item != null && viewer.getInput() != null) {
TestportParameterSectionHandler testportParameterSectionHandler = (TestportParameterSectionHandler) viewer.getInput();
TestportParameter element = (TestportParameter) event.item.getData();
TestportParameter[] items = (TestportParameter[]) event.data;
int baseindex = testportParameterSectionHandler.getTestportParameters().indexOf(element);
final ParseTree parent = testportParameterSectionHandler.getLastSectionRoot();
ConfigTreeNodeUtilities.removeChild(parent, element.getRoot());
ConfigTreeNodeUtilities.addChild(parent, element.getRoot(), baseindex);
if (items.length > 0) {
for (int i = 0; i < items.length - 1; i++) {
testportParameterSectionHandler.getTestportParameters().add(++baseindex, items[i]);
}
testportParameterSectionHandler.getTestportParameters().add(++baseindex, items[items.length - 1]);
}
viewer.refresh(true);
editor.setDirty();
}
}
}
use of org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler.TestportParameter in project titan.EclipsePlug-ins by eclipse.
the class TestportParametersSectionPage method createNewParameter.
private TestportParameter createNewParameter() {
if (testportParametersHandler == null) {
return null;
}
TestportParameter newTestportParameter = new TestportParameterSectionHandler.TestportParameter();
final ParseTree root = new ParserRuleContext();
newTestportParameter.setRoot(root);
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("\n"));
newTestportParameter.setComponentName(new AddedParseTree("component_name"));
ConfigTreeNodeUtilities.addChild(root, newTestportParameter.getComponentName());
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("."));
newTestportParameter.setTestportName(new AddedParseTree("testport_name"));
ConfigTreeNodeUtilities.addChild(root, newTestportParameter.getTestportName());
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("."));
newTestportParameter.setParameterName(new AddedParseTree("parameter_name"));
ConfigTreeNodeUtilities.addChild(root, newTestportParameter.getParameterName());
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(" := "));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("\"value\""));
return newTestportParameter;
}
use of org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler.TestportParameter in project titan.EclipsePlug-ins by eclipse.
the class TestportParametersSectionPage 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);
parameterValueText.setLayoutData(new GridData(GridData.FILL_BOTH));
parameterValueText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
StructuredSelection selection = (StructuredSelection) testportParametersTableViewer.getSelection();
Iterator<?> iterator = selection.iterator();
if (!iterator.hasNext()) {
return;
}
TestportParameter testportParameter = (TestportParameter) iterator.next();
ConfigTreeNodeUtilities.setText(testportParameter.getValue(), parameterValueText.getText());
if (valueChanged) {
valueChanged = false;
return;
}
editor.setDirty();
}
});
parameterValueText.setEnabled(testportParametersHandler != null);
section.setText("Testport parameter details");
section.setDescription("Specify the concrete value for the actually selected testport 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.TestportParameterSectionHandler.TestportParameter in project titan.EclipsePlug-ins by eclipse.
the class TestportParametersSectionPage method removeSelectedParameters.
public void removeSelectedParameters() {
if (testportParametersTableViewer == null || testportParametersHandler == null) {
return;
}
StructuredSelection selection = (StructuredSelection) testportParametersTableViewer.getSelection();
Iterator<?> iterator = selection.iterator();
// remove the selected elements
for (; iterator.hasNext(); ) {
TestportParameter testportParameter = (TestportParameter) iterator.next();
if (testportParameter != null) {
ConfigTreeNodeUtilities.removeChild(testportParametersHandler.getLastSectionRoot(), testportParameter.getRoot());
testportParametersHandler.getTestportParameters().remove(testportParameter);
}
}
testportParametersTableViewer.setSelection(null);
}
Aggregations