Search in sources :

Example 36 with AddedParseTree

use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.

the class LoggingPage method createLoggingSection.

public void createLoggingSection() {
    if (loggingSectionHandler == null || loggingSectionHandler.getLastSectionRoot() != null) {
        return;
    }
    ParserRuleContext sectionRoot = new ParserRuleContext();
    loggingSectionHandler.setLastSectionRoot(sectionRoot);
    ParseTree header = new AddedParseTree("\n[LOGGING]");
    ConfigTreeNodeUtilities.addChild(sectionRoot, header);
    ParserRuleContext root = editor.getParseTreeRoot();
    if (root != null) {
        root.addChild(sectionRoot);
    }
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 37 with AddedParseTree

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

Example 38 with AddedParseTree

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

Example 39 with AddedParseTree

use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.

the class ExecuteItemTransfer method nativeToJava.

@Override
protected ExecuteItem[] nativeToJava(final TransferData transferData) {
    byte[] bytes = (byte[]) super.nativeToJava(transferData);
    DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
    try {
        int n = in.readInt();
        ExecuteItem[] items = new ExecuteItem[n];
        String moduleName;
        String testcaseName;
        String hiddenBefore;
        for (int i = 0; i < n; i++) {
            items[i] = new ExecuteSectionHandler.ExecuteItem();
            final ParseTree root = new ParserRuleContext();
            items[i].setRoot(root);
            hiddenBefore = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode(hiddenBefore));
            moduleName = in.readUTF();
            final ParseTree moduleNameNode = new AddedParseTree(moduleName);
            items[i].setModuleName(moduleNameNode);
            ConfigTreeNodeUtilities.addChild(root, moduleNameNode);
            hiddenBefore = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode(hiddenBefore));
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("."));
            hiddenBefore = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode(hiddenBefore));
            testcaseName = in.readUTF();
            final ParseTree testcaseNameNode = new AddedParseTree(testcaseName);
            items[i].setTestcaseName(testcaseNameNode);
            ConfigTreeNodeUtilities.addChild(root, testcaseNameNode);
        }
        return items;
    } catch (IOException e) {
        ErrorReporter.logExceptionStackTrace(e);
        return new ExecuteItem[] {};
    }
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) ExecuteItem(org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler.ExecuteItem) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ByteArrayInputStream(java.io.ByteArrayInputStream) ExecuteItem(org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler.ExecuteItem) ExecuteSectionHandler(org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 40 with AddedParseTree

use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.

the class ExecuteSubPage method createNewExecuteSection.

private void createNewExecuteSection() {
    if (executeSectionHandler == null) {
        return;
    }
    ParserRuleContext sectionRoot = new ParserRuleContext();
    executeSectionHandler.setLastSectionRoot(sectionRoot);
    ParseTree header = new AddedParseTree("\n[EXECUTE]");
    ConfigTreeNodeUtilities.addChild(sectionRoot, header);
    ParserRuleContext root = editor.getParseTreeRoot();
    if (root != null) {
        root.addChild(sectionRoot);
    }
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Aggregations

AddedParseTree (org.eclipse.titan.common.parsers.AddedParseTree)45 ParserRuleContext (org.antlr.v4.runtime.ParserRuleContext)41 ParseTree (org.antlr.v4.runtime.tree.ParseTree)32 ByteArrayInputStream (java.io.ByteArrayInputStream)6 DataInputStream (java.io.DataInputStream)6 IOException (java.io.IOException)6 TerminalNodeImpl (org.antlr.v4.runtime.tree.TerminalNodeImpl)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)3 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)3 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)3 Section (org.eclipse.ui.forms.widgets.Section)3 Token (org.antlr.v4.runtime.Token)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 Component (org.eclipse.titan.common.parsers.cfg.indices.ComponentSectionHandler.Component)2 Definition (org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler.Definition)2 ExecuteItem (org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler.ExecuteItem)2