Search in sources :

Example 6 with Definition

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;
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) Definition(org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 7 with Definition

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);
}
Also used : Definition(org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 8 with 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);
        }
    }
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Definition(org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition)

Aggregations

Definition (org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition)8 ParseTree (org.antlr.v4.runtime.tree.ParseTree)3 IOException (java.io.IOException)2 ParserRuleContext (org.antlr.v4.runtime.ParserRuleContext)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 AddedParseTree (org.eclipse.titan.common.parsers.AddedParseTree)2 DefineSectionHandler (org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataInputStream (java.io.DataInputStream)1 DataOutputStream (java.io.DataOutputStream)1 ArrayList (java.util.ArrayList)1 ICellModifier (org.eclipse.jface.viewers.ICellModifier)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1