Commit e14adf9c authored by earplov's avatar earplov
Browse files

bugfix: Config Editor: logging and executing section


Signed-off-by: default avatarearplov <arpad.lovassy@ericsson.com>
parent dfdf1689
/******************************************************************************
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
package org.eclipse.titan.common.parsers;
import org.antlr.v4.runtime.Parser;
......@@ -8,8 +15,8 @@ import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* Parse tree type for adding new strings to an existing ParseTree structure,
* which was build during a parsing.
* It has no info about its start and end tokens, it just contains a string
* It can have children
* It has NO info about its start and end tokens, it just contains a string
* It has NO children
* @author Arpad Lovassy
*/
public class AddedParseTree implements ParseTree {
......
......@@ -156,10 +156,12 @@ LINE_COMMENT3:
) -> channel(HIDDEN);
BLOCK_COMMENT3: '/*' .*? '*/' -> channel(HIDDEN);
SEMICOLON3: ';';
DOT3: '.';
fragment LETTER3: [A-Z|a-z];
fragment NUMBER3: [0-9];
fragment TTCN3IDENTIFIER3: LETTER3 (LETTER3 | NUMBER3 | '_')*;
TEST3: TTCN3IDENTIFIER3 ('.' (TTCN3IDENTIFIER3 | '*'))?;
TEST_MODULE3: TTCN3IDENTIFIER3;
TEST_TESTCASE3: (TTCN3IDENTIFIER3 | '*');
//ordered include section
mode ORDERED_INCLUDE_SECTION_MODE;
......
......@@ -8,6 +8,7 @@ import org.eclipse.titan.common.parsers.TITANMarker;
import org.eclipse.titan.common.parsers.cfg.indices.ComponentSectionHandler;
import org.eclipse.titan.common.parsers.cfg.indices.DefineSectionHandler;
import org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler;
import org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler.ExecuteItem;
import org.eclipse.titan.common.parsers.cfg.indices.ExternalCommandSectionHandler;
import org.eclipse.titan.common.parsers.cfg.indices.GroupSectionHandler;
import org.eclipse.titan.common.parsers.cfg.indices.IncludeSectionHandler;
......@@ -407,11 +408,40 @@ pr_ExecuteSection:
pr_ExecuteSectionItem*
;
pr_ExecuteSectionItem:
t = TEST3 { mCfgParseResult.getExecuteElements().add( $t.getText() ); }
pr_ExecuteSectionItem
@init {
String executeElement = "";
ExecuteItem item = new ExecuteItem();
}:
module = pr_ExecuteSectionItemModuleName
{
executeElement += $module.name;
item.setModuleName( $module.ctx );
}
( DOT3
testcase = pr_ExecuteSectionItemTestcaseName
{
executeElement += $testcase.name;
item.setTestcaseName( $testcase.ctx );
}
)?
{ mCfgParseResult.getExecuteElements().add( executeElement );
item.setRoot( $ctx );
executeSectionHandler.getExecuteitems().add( item );
}
SEMICOLON3?
;
pr_ExecuteSectionItemModuleName returns [ String name ]:
t = TEST_MODULE3
{ $name = $t.text != null ? $t.text : "";
};
pr_ExecuteSectionItemTestcaseName returns [ String name ]:
t = TEST_TESTCASE3?
{ $name = $t.text != null ? $t.text : "";
};
pr_DefineSection:
DEFINE_SECTION
( def = pr_MacroAssignment
......@@ -450,7 +480,11 @@ pr_GroupsSection:
pr_ModuleParametersSection:
MODULE_PARAMETERS_SECTION
( param = pr_ModuleParam {if($param.parameter != null) {moduleParametersHandler.getModuleParameters().add($param.parameter);}}
( param = pr_ModuleParam
{ if ( $param.parameter != null ) {
moduleParametersHandler.getModuleParameters().add( $param.parameter );
}
}
SEMICOLON9?
)*
;
......
......@@ -82,6 +82,10 @@ public final class ConfigTreeNodeUtilities {
final TokenStream aTokenStream,
final StringBuilder aSb,
final List<Integer> aDisallowedNodes ) {
if ( aParseTree == null ) {
//TODO: warning
return;
}
if ( aParseTree instanceof ParserRuleContext ) {
final ParserRuleContext rule = (ParserRuleContext)aParseTree;
if ( aDisallowedNodes != null && aDisallowedNodes.contains( rule.start.getType() ) ) {
......
......@@ -39,6 +39,9 @@ import org.eclipse.ui.part.FileEditorInput;
* @author Arpad Lovassy
*/
public final class ConfigEditor extends FormEditor implements IResourceChangeListener {
private static final boolean CONFIG_EDITOR_TABS_VISIBLE = true;
private ConfigTextEditor editor;
private int editorPageIndex;
......@@ -123,8 +126,9 @@ public final class ConfigEditor extends FormEditor implements IResourceChangeLis
}
public void refresh(final CfgAnalyzer cfgAnalyzer) {
//TODO: implement
/*
if ( !CONFIG_EDITOR_TABS_VISIBLE ) {
return;
}
getSite().getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
......@@ -139,14 +143,14 @@ public final class ConfigEditor extends FormEditor implements IResourceChangeLis
mLoggingEditor.refreshData( cfgAnalyzer.getLoggingSectionHandler() );
}
});
//*/
}
public void setErrorMessage(final String errorMessage) {
this.errorMessage = errorMessage;
//TODO: implement
/*
if ( !CONFIG_EDITOR_TABS_VISIBLE ) {
return;
}
getSite().getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
......@@ -158,33 +162,31 @@ public final class ConfigEditor extends FormEditor implements IResourceChangeLis
mLoggingEditor.setErrorMessage();
}
});
//*/
}
@Override
protected void addPages() {
//TODO: implement
//*
createTextEditorPage();
/*/
try {
if ( CONFIG_EDITOR_TABS_VISIBLE ) {
try {
createTextEditorPage();
mModuleParameterSectionEditor = new ModuleParameterSectionPage(this);
addPage(mModuleParameterSectionEditor);
mTestportParameterSectionEditor = new TestportParametersSectionPage(this);
addPage(mTestportParameterSectionEditor);
mComponentGroupMCSectionEditor = new ComponentsGroupsMCPage(this);
addPage(mComponentGroupMCSectionEditor);
mExecuteExternalCommandsEditor = new ExecuteExternalcommandsPage(this);
addPage(mExecuteExternalCommandsEditor);
mIncludeDefineEditor = new IncludeDefinePage(this);
addPage(mIncludeDefineEditor);
mLoggingEditor = new LoggingPage(this);
addPage(mLoggingEditor);
} catch (PartInitException e) {
ErrorReporter.logExceptionStackTrace(e);
}
} else {
createTextEditorPage();
mModuleParameterSectionEditor = new ModuleParameterSectionPage(this);
addPage(mModuleParameterSectionEditor);
mTestportParameterSectionEditor = new TestportParametersSectionPage(this);
addPage(mTestportParameterSectionEditor);
mComponentGroupMCSectionEditor = new ComponentsGroupsMCPage(this);
addPage(mComponentGroupMCSectionEditor);
mExecuteExternalCommandsEditor = new ExecuteExternalcommandsPage(this);
addPage(mExecuteExternalCommandsEditor);
mIncludeDefineEditor = new IncludeDefinePage(this);
addPage(mIncludeDefineEditor);
mLoggingEditor = new LoggingPage(this);
addPage(mLoggingEditor);
} catch (PartInitException e) {
ErrorReporter.logExceptionStackTrace(e);
}
//*/
setPartName(getEditorInput().getName());
}
......
......@@ -254,10 +254,10 @@ public final class LoggingBitsSubPage {
ParseTree node = new AddedParseTree(name.toString());
ConfigTreeNodeUtilities.addChild( consoleMaskRoot, node );
ParseTree consoleMask = new AddedParseTree("");
ParseTree consoleMask = new ParserRuleContext();
logentry.setConsoleMask( consoleMask );
ConfigTreeNodeUtilities.addChild( consoleMaskRoot, consoleMask );
ConfigTreeNodeUtilities.addChild( loggingSectionHandler.getLastSectionRoot(), consoleMaskRoot, 0 );
ConfigTreeNodeUtilities.addChild( loggingSectionHandler.getLastSectionRoot(), consoleMaskRoot );
}
private void createFileMaskRootNode(final LoggingSectionHandler.LoggerTreeElement lte, final LogParamEntry logentry) {
......@@ -272,10 +272,10 @@ public final class LoggingBitsSubPage {
ParseTree node = new AddedParseTree(name.toString());
ConfigTreeNodeUtilities.addChild( fileMaskRoot, node );
ParseTree fileMask = new AddedParseTree("");
ParseTree fileMask = new ParserRuleContext();
logentry.setFileMask( fileMask );
ConfigTreeNodeUtilities.addChild( fileMaskRoot, fileMask );
ConfigTreeNodeUtilities.addChild( loggingSectionHandler.getLastSectionRoot(), fileMaskRoot, 0 );
ConfigTreeNodeUtilities.addChild( loggingSectionHandler.getLastSectionRoot(), fileMaskRoot );
}
private void checkStateChangeHandler(final Map<LoggingBit, ParseTree> bitMask, final ParseTree bitmaskRoot,
......@@ -386,10 +386,10 @@ public final class LoggingBitsSubPage {
if (bitMask.keySet().size() > 1) {
ParseTree separator = new AddedParseTree("|");
ConfigTreeNodeUtilities.addChild(bitmaskRoot, separator, 0);
ConfigTreeNodeUtilities.addChild( bitmaskRoot, separator );
}
ConfigTreeNodeUtilities.addChild(bitmaskRoot, newBit, 0);
ConfigTreeNodeUtilities.addChild( bitmaskRoot, newBit );
}
private void removeLoggingBit(final Map<LoggingBit, ParseTree> bitMask, final LoggingBit bit) {
......
......@@ -98,7 +98,8 @@ import static org.eclipse.titan.executor.properties.FieldEditorPropertyPage.getO
* It tries to hide all of the launchConfiguration handling and HC starting issues from the specific Executors
*
* @author Kristof Szabados
* */
* @author Arpad Lovassy
*/
public abstract class BaseExecutor {
//TODO: implement
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment