Search in sources :

Example 6 with AddedParseTree

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

the class LoggingTreeSubPage method addPluginToList.

/**
 * Adds a new logging plugin to the list of logging plugins available
 * for a given component. If necessary also creates the list of logging
 * plugins.
 *
 * @param componentName
 *                the name of the component to add the plugin to.
 * @param pluginName
 *                the name of the plugin to add
 * @param path
 *                the path of the plugin to add, or null if none.
 */
private void addPluginToList(final String componentName, final String pluginName, final String path) {
    if (loggingSectionHandler == null) {
        return;
    }
    final StringBuilder pluginBuilder = new StringBuilder();
    pluginBuilder.append(pluginName);
    if (path != null && path.length() != 0) {
        pluginBuilder.append(" := \"").append(path).append('\"');
    }
    /*
		 *   loggingSectionHandler.getLastSectionRoot()
		 *     entry.getLoggerPluginsRoot()
		 *       entry.getLoggerPluginsListRoot()
		 *         {
		 *           pluginEntry.getLoggerPluginRoot()
		 *         }
		 */
    LoggingSectionHandler.LoggerPluginsEntry entry = loggingSectionHandler.getLoggerPluginsTree().get(componentName);
    if (entry == null) {
        entry = new LoggingSectionHandler.LoggerPluginsEntry();
        loggingSectionHandler.getLoggerPluginsTree().put(componentName, entry);
        final ParseTree loggerPluginsRoot = new ParserRuleContext();
        ConfigTreeNodeUtilities.addChild(loggingSectionHandler.getLastSectionRoot(), loggerPluginsRoot);
        entry.setLoggerPluginsRoot(loggerPluginsRoot);
        final StringBuilder builder = new StringBuilder();
        builder.append('\n').append(componentName).append(".LoggerPlugins := ");
        ConfigTreeNodeUtilities.addChild(loggerPluginsRoot, new AddedParseTree(builder.toString()));
        ConfigTreeNodeUtilities.addChild(loggerPluginsRoot, new AddedParseTree("{"));
        final ParseTree loggerPluginsListRoot = new ParserRuleContext();
        entry.setLoggerPluginsListRoot(loggerPluginsListRoot);
        final LoggingSectionHandler.LoggerPluginEntry pluginEntry = new LoggingSectionHandler.LoggerPluginEntry();
        final ParseTree pluginRoot = new ParserRuleContext();
        pluginEntry.setLoggerPluginRoot(pluginRoot);
        pluginEntry.setName(pluginName);
        pluginEntry.setPath(path);
        ConfigTreeNodeUtilities.addChild(pluginRoot, new AddedParseTree(pluginBuilder.toString()));
        entry.setPluginRoots(new HashMap<String, LoggingSectionHandler.LoggerPluginEntry>(1));
        entry.getPluginRoots().put(pluginName, pluginEntry);
        ConfigTreeNodeUtilities.addChild(loggerPluginsListRoot, pluginRoot);
        ConfigTreeNodeUtilities.addChild(loggerPluginsRoot, loggerPluginsListRoot);
        ConfigTreeNodeUtilities.addChild(loggerPluginsRoot, new AddedParseTree("}"));
        return;
    }
    final int childCount = entry.getLoggerPluginsListRoot().getChildCount();
    ConfigTreeNodeUtilities.addChild(entry.getLoggerPluginsListRoot(), new AddedParseTree((childCount > 0 ? ", " : "") + pluginBuilder.toString()));
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) LoggingSectionHandler(org.eclipse.titan.common.parsers.cfg.indices.LoggingSectionHandler) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 7 with AddedParseTree

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

the class ModuleParameterSectionPage method createNewModuleParameterSection.

private void createNewModuleParameterSection() {
    if (moduleParametersHandler == null) {
        return;
    }
    ParserRuleContext sectionRoot = new ParserRuleContext();
    moduleParametersHandler.setLastSectionRoot(sectionRoot);
    ParseTree header = new AddedParseTree("\n[MODULE_PARAMETERS]");
    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 8 with AddedParseTree

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

the class GeneralOptionsSubPage method createLogFileNode.

private void createLogFileNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry, final String value) {
    logentry.setLogFileRoot(new ParserRuleContext());
    logentry.setLogFile(new AddedParseTree(value));
    createNode(lte, logentry, value, "LogFile", logentry.getLogFileRoot(), logentry.getLogFile());
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree)

Example 9 with AddedParseTree

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

the class GeneralOptionsSubPage method createSourceInfoFormatNode.

private void createSourceInfoFormatNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry, final String value) {
    logentry.setSourceInfoFormatRoot(new ParserRuleContext());
    logentry.setSourceInfoFormat(new AddedParseTree(value));
    createNode(lte, logentry, value, "SourceInfoFormat", logentry.getSourceInfoFormatRoot(), logentry.getSourceInfoFormat());
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree)

Example 10 with AddedParseTree

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

the class GeneralOptionsSubPage method createAppendFileNode.

private void createAppendFileNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry, final String value) {
    logentry.setAppendFileRoot(new ParserRuleContext());
    logentry.setAppendFile(new AddedParseTree(value));
    createNode(lte, logentry, value, "AppendFile", logentry.getAppendFileRoot(), logentry.getAppendFile());
}
Also used : ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) AddedParseTree(org.eclipse.titan.common.parsers.AddedParseTree)

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