Commit 6e3b397f authored by Árpád Lovassy's avatar Árpád Lovassy Committed by GitHub
Browse files

Merge pull request #92 from alovassy/master

code cleanup
parents 30be7332 85ae20be
......@@ -11,7 +11,6 @@ import java.util.ArrayList;
import java.util.List;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.WritableToken;
......@@ -288,28 +287,4 @@ public final class ConfigTreeNodeUtilities {
public static TerminalNodeImpl createHiddenTokenNode( final String aText ) {
return new TerminalNodeImpl( new CommonToken( 0, aText ) );
}
//TODO: remove, call directly
/**
* Builds parse tree text including hidden tokens (also before the rule)
* @param aParseTreeRoot root of the parse tree to print
* @param aTokens token list from the lexer (all, hidden and not hidden also)
* @return output parse tree text
*/
public static String toStringWithHiddenBefore( final ParseTree aParseTreeRoot,
final List<Token> aTokens ) {
return CfgParseTreePrinter.toStringWithHidden( aParseTreeRoot, aTokens, true );
}
//TODO: remove, call directly
/**
* Builds parse tree text including hidden tokens (but not before the rule)
* @param aParseTreeRoot root of the parse tree to print
* @param aTokens token list from the lexer (all, hidden and not hidden also)
* @return output parse tree text
*/
public static String toStringWithHidden( final ParseTree aParseTreeRoot,
final List<Token> aTokens ) {
return CfgParseTreePrinter.toStringWithHidden( aParseTreeRoot, aTokens, false );
}
}
......@@ -20,7 +20,7 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.titan.common.logging.ErrorReporter;
import org.eclipse.titan.common.parsers.cfg.CfgAnalyzer;
import org.eclipse.titan.common.parsers.cfg.ConfigTreeNodeUtilities;
import org.eclipse.titan.common.parsers.cfg.CfgParseTreePrinter;
import org.eclipse.titan.designer.editors.configeditor.pages.compgroupmc.ComponentsGroupsMCPage;
import org.eclipse.titan.designer.editors.configeditor.pages.execute.ExecuteExternalcommandsPage;
import org.eclipse.titan.designer.editors.configeditor.pages.include.IncludeDefinePage;
......@@ -237,7 +237,7 @@ public final class ConfigEditor extends FormEditor implements IResourceChangeLis
private void updateTextualPage() {
if (mParseTreeRoot != null && mTokens != null) {
String original = editor.getDocument().get();
String content = ConfigTreeNodeUtilities.toStringWithHiddenBefore( mParseTreeRoot, mTokens );
String content = CfgParseTreePrinter.toStringWithHidden( mParseTreeRoot, mTokens, true );
if (!content.equals(original)) {
editor.getDocument().set(content);
......
......@@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.titan.common.parsers.AddedParseTree;
import org.eclipse.titan.common.parsers.cfg.CfgParseTreePrinter;
import org.eclipse.titan.common.parsers.cfg.ConfigTreeNodeUtilities;
import org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler;
import org.eclipse.titan.common.parsers.cfg.indices.ModuleParameterSectionHandler.ModuleParameter;
......@@ -239,8 +240,8 @@ public final class ModuleParameterSectionPage extends FormPage {
ModuleParameter moduleParameter = (ModuleParameter) selection.getFirstElement();
if (moduleParameter != null) {
if (moduleParameter.getValue() != null) {
final String moduleParamValueText = ConfigTreeNodeUtilities.toStringWithHidden(
moduleParameter.getValue(), editor.getTokens() );
final String moduleParamValueText = CfgParseTreePrinter.toStringWithHidden(
moduleParameter.getValue(), editor.getTokens(), false );
parameterValueText.setText( moduleParamValueText );
}
......
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