Search in sources :

Example 11 with AddedParseTree

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

the class GeneralOptionsSubPage method createDiskFullActionNode.

private void createDiskFullActionNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry, final String value) {
    logentry.setDiskFullActionRoot(new ParserRuleContext());
    logentry.setDiskFullAction(new AddedParseTree(value));
    createNode(lte, logentry, value, "DiskFullAction", logentry.getDiskFullActionRoot(), logentry.getDiskFullAction());
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree)

Example 12 with AddedParseTree

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

the class GeneralOptionsSubPage method createMatchingHintsNode.

private void createMatchingHintsNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry, final String value) {
    logentry.setMatchingHintsRoot(new ParserRuleContext());
    logentry.setMatchingHints(new AddedParseTree(value));
    createNode(lte, logentry, value, "MatchingHints", logentry.getMatchingHintsRoot(), logentry.getMatchingHints());
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree)

Example 13 with AddedParseTree

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

the class GeneralOptionsSubPage method createNode.

private void createNode(final LoggingSectionHandler.LoggerTreeElement aLte, final LogParamEntry aLogEntry, final String aValue, final String aNodeText, final ParseTree aRoot, final ParseTree aData) {
    ConfigTreeNodeUtilities.addChild(loggingSectionHandler.getLastSectionRoot(), aRoot);
    final StringBuilder name = new StringBuilder();
    aLte.writeNamePrefix(name);
    name.append(aNodeText + " := ");
    ConfigTreeNodeUtilities.addChild(aRoot, new AddedParseTree("\n"));
    ConfigTreeNodeUtilities.addChild(aRoot, new AddedParseTree(name.toString()));
    ConfigTreeNodeUtilities.addChild(aRoot, aData);
}
Also used : AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree)

Example 14 with AddedParseTree

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

the class LoggingBitsSubPage method createConsoleMaskRootNode.

private void createConsoleMaskRootNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry) {
    ParseTree consoleMaskRoot = new ParserRuleContext();
    logentry.setConsoleMaskRoot(consoleMaskRoot);
    ConfigTreeNodeUtilities.addChild(consoleMaskRoot, new AddedParseTree("\n"));
    StringBuilder name = new StringBuilder();
    lte.writeNamePrefix(name);
    name.append("ConsoleMask := ");
    ParseTree node = new AddedParseTree(name.toString());
    ConfigTreeNodeUtilities.addChild(consoleMaskRoot, node);
    ParseTree consoleMask = new ParserRuleContext();
    logentry.setConsoleMask(consoleMask);
    ConfigTreeNodeUtilities.addChild(consoleMaskRoot, consoleMask);
    ConfigTreeNodeUtilities.addChild(loggingSectionHandler.getLastSectionRoot(), consoleMaskRoot);
}
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 15 with AddedParseTree

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

the class ModuleParameterTransfer method nativeToJava.

@Override
protected ModuleParameter[] nativeToJava(final TransferData transferData) {
    byte[] bytes = (byte[]) super.nativeToJava(transferData);
    DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
    try {
        int n = in.readInt();
        ModuleParameter[] items = new ModuleParameter[n];
        for (int i = 0; i < n; i++) {
            ModuleParameter newModuleParameter = new ModuleParameterSectionHandler.ModuleParameter();
            final ParseTree root = new ParserRuleContext();
            newModuleParameter.setRoot(root);
            // module name part
            final String hiddenBeforeModuleName = in.readUTF();
            final String moduleName = in.readUTF();
            final String hiddenBeforeSeparator = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("\n"));
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeModuleName));
            newModuleParameter.setModuleName(new AddedParseTree(moduleName));
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeSeparator));
            ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getModuleName());
            final boolean isModuleNameEmpty = moduleName == null || moduleName.isEmpty();
            newModuleParameter.setSeparator(new AddedParseTree(isModuleNameEmpty ? "" : "."));
            ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getSeparator());
            // parameter name part
            final String hiddenBeforeParameterName = in.readUTF();
            final String parameterName = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeParameterName));
            newModuleParameter.setParameterName(new AddedParseTree(parameterName));
            ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getParameterName());
            // the := sign and the hidden stuff before it
            final String hiddenBeforeOperator = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeOperator));
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(" := "));
            // the value part
            final String hiddenBeforeValue = in.readUTF();
            final String value = in.readUTF();
            ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeValue));
            newModuleParameter.setValue(new AddedParseTree(value));
            ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getValue());
            // put it under the root node
            items[i] = newModuleParameter;
        }
        return items;
    } catch (IOException e) {
        ErrorReporter.logExceptionStackTrace(e);
        return new ModuleParameter[] {};
    }
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) ModuleParameter(org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream) 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