diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring')
2 files changed, 39 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring/CftLanguageSemanticHighlightingCalculator.xtend b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring/CftLanguageSemanticHighlightingCalculator.xtend new file mode 100644 index 00000000..47c9ebdf --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring/CftLanguageSemanticHighlightingCalculator.xtend | |||
@@ -0,0 +1,24 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.components.ui.syntaxcoloring | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.KOfMGateDefinition | ||
4 | import org.eclipse.emf.ecore.EObject | ||
5 | import org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator | ||
6 | import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor | ||
7 | import org.eclipse.xtext.util.CancelIndicator | ||
8 | |||
9 | import static hu.bme.mit.inf.dslreasoner.faulttree.model.cft.CftPackage.Literals.* | ||
10 | import static org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration.* | ||
11 | |||
12 | class CftLanguageSemanticHighlightingCalculator extends DefaultSemanticHighlightingCalculator { | ||
13 | protected dispatch def highlightElement(KOfMGateDefinition gate, IHighlightedPositionAcceptor acceptor, | ||
14 | CancelIndicator cancelIndicator) { | ||
15 | acceptor.highlightFeature(gate, KOF_MGATE_DEFINITION__K, KEYWORD_ID) | ||
16 | acceptor.highlightFeature(gate, KOF_MGATE_DEFINITION__M, KEYWORD_ID) | ||
17 | false | ||
18 | } | ||
19 | |||
20 | protected dispatch def highlightElement(EObject eObject, IHighlightedPositionAcceptor acceptor, | ||
21 | CancelIndicator cancelIndicator) { | ||
22 | super.highlightElement(eObject, acceptor, cancelIndicator) | ||
23 | } | ||
24 | } | ||
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring/CftLanguageTokenToAttributeIdMapper.xtend b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring/CftLanguageTokenToAttributeIdMapper.xtend new file mode 100644 index 00000000..4656d0a0 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components.ui/src/hu/bme/mit/inf/dslreasoner/faulttree/components/ui/syntaxcoloring/CftLanguageTokenToAttributeIdMapper.xtend | |||
@@ -0,0 +1,15 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.components.ui.syntaxcoloring | ||
2 | |||
3 | import org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper | ||
4 | import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles | ||
5 | |||
6 | class CftLanguageTokenToAttributeIdMapper extends DefaultAntlrTokenToAttributeIdMapper { | ||
7 | override protected calculateId(String tokenName, int tokenType) { | ||
8 | switch (tokenName) { | ||
9 | case "RULE_T_DOUBLE": | ||
10 | HighlightingStyles.NUMBER_ID | ||
11 | default: | ||
12 | super.calculateId(tokenName, tokenType) | ||
13 | } | ||
14 | } | ||
15 | } \ No newline at end of file | ||