blob: 765845c525e58465fa5018aa450648e0f1b88af4 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*/
package org.eclipse.osbp.xtext.datamartdsl.formatting;
import com.google.inject.Inject;
import org.eclipse.osbp.utils.xtext.GenericFormatter;
import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
import org.eclipse.xtext.xbase.services.XtypeGrammarAccess;
/**
* This class contains custom formatting description.
*
* see : http://www.eclipse.org/Xtext/documentation.html#formatting
* on how and when to use it
*
* Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
*/
@SuppressWarnings("all")
public class DatamartDSLFormatter extends AbstractDeclarativeFormatter {
@Inject
private XtypeGrammarAccess grammarAccess;
protected void configureFormatting(final FormattingConfig c) {
final GenericFormatter genericFormatter = new GenericFormatter();
Grammar _grammar = this.grammar.getGrammar();
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(_grammar, "DatamartReference");
ParserRule referenceDef = ((ParserRule) _findRuleForName);
Grammar _grammar_1 = this.grammar.getGrammar();
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(_grammar_1, "DatamartSlicer");
ParserRule slicerDef = ((ParserRule) _findRuleForName_1);
Grammar _grammar_2 = this.grammar.getGrammar();
AbstractRule _findRuleForName_2 = GrammarUtil.findRuleForName(_grammar_2, "DatamartHierarchy");
ParserRule hierarchyDef = ((ParserRule) _findRuleForName_2);
Grammar _grammar_3 = this.grammar.getGrammar();
AbstractRule _findRuleForName_3 = GrammarUtil.findRuleForName(_grammar_3, "DatamartMeasure");
ParserRule measureDef = ((ParserRule) _findRuleForName_3);
Grammar _grammar_4 = this.grammar.getGrammar();
AbstractRule _findRuleForName_4 = GrammarUtil.findRuleForName(_grammar_4, "DatamartNumberOrElement");
ParserRule numOrElementDef = ((ParserRule) _findRuleForName_4);
Grammar _grammar_5 = this.grammar.getGrammar();
AbstractRule _findRuleForName_5 = GrammarUtil.findRuleForName(_grammar_5, "DatamartCondition");
ParserRule conditionDef = ((ParserRule) _findRuleForName_5);
Grammar _grammar_6 = this.grammar.getGrammar();
AbstractRule _findRuleForName_6 = GrammarUtil.findRuleForName(_grammar_6, "DatamartConditionalExpression");
ParserRule condExprDef = ((ParserRule) _findRuleForName_6);
FormattingConfig.NoLinewrapLocator _setNoLinewrap = c.setNoLinewrap();
_setNoLinewrap.before(referenceDef);
FormattingConfig.NoLinewrapLocator _setNoLinewrap_1 = c.setNoLinewrap();
_setNoLinewrap_1.between(slicerDef, hierarchyDef);
FormattingConfig.NoLinewrapLocator _setNoLinewrap_2 = c.setNoLinewrap();
_setNoLinewrap_2.between(conditionDef, condExprDef);
FormattingConfig.NoLinewrapLocator _setNoLinewrap_3 = c.setNoLinewrap();
_setNoLinewrap_3.between(hierarchyDef, measureDef);
FormattingConfig.NoLinewrapLocator _setNoLinewrap_4 = c.setNoLinewrap();
_setNoLinewrap_4.before(numOrElementDef);
Grammar _grammar_7 = this.grammar.getGrammar();
genericFormatter.formatFirstLevelBlocks(c, _grammar_7, "DatamartDefinition", "DatamartImport");
genericFormatter.genericFormatting(c, this.grammar, this.grammarAccess);
}
}