use of org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition in project titan.EclipsePlug-ins by eclipse.
the class DefineSubPage method createNewDefineItem.
private Definition createNewDefineItem() {
if (defineSectionHandler == null) {
return null;
}
final Definition item = new DefineSectionHandler.Definition();
final ParseTree root = new ParserRuleContext();
item.setRoot(root);
final ParseTree name = new AddedParseTree("definition_name");
final ParseTree value = new AddedParseTree("definition_value");
item.setDefinitionName(name);
item.setDefinitionValue(value);
ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode("\n"));
ConfigTreeNodeUtilities.addChild(root, name);
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(" := "));
ConfigTreeNodeUtilities.addChild(root, value);
return item;
}
use of org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition in project titan.EclipsePlug-ins by eclipse.
the class DefineSectionDragSourceListener method dragStart.
@Override
public void dragStart(final DragSourceEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
event.doit = !selection.isEmpty() && (selection.getFirstElement() instanceof Definition);
}
use of org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition in project titan.EclipsePlug-ins by eclipse.
the class DefineSubPage method removeSelectedDefineItems.
public void removeSelectedDefineItems() {
if (defineSectionHandler == null || defineElementsTableViewer == null) {
return;
}
StructuredSelection selection = (StructuredSelection) defineElementsTableViewer.getSelection();
// remove the selected elements
for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
Definition item = (Definition) iterator.next();
if (item != null) {
ConfigTreeNodeUtilities.removeChild(defineSectionHandler.getLastSectionRoot(), item.getRoot());
defineSectionHandler.getDefinitions().remove(item);
}
}
}
Aggregations