Class VilHighlightingCalculator
- java.lang.Object
-
- de.uni_hildesheim.sse.vil.expressions.ui.highlighting.VilHighlightingCalculator
-
- All Implemented Interfaces:
org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator
public class VilHighlightingCalculator extends java.lang.Object implements org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculatorThis class enables the customization of syntax-highlighting in the VIL build and template language editors.- Author:
- dernek, kroeher
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCOMPLEX_HIGHLIGHT_REGEXThe regex which identifies the string to be highlighted (within a common string).private static java.lang.StringSIMPLE_HIGHLIGHT_REGEXThe regex which identifies the string to be highlighted (single string).
-
Constructor Summary
Constructors Constructor Description VilHighlightingCalculator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanhasRootNode(org.eclipse.xtext.resource.XtextResource resource)Check whether the given resource is notnulland provides root-node.voidprovideHighlightingFor(org.eclipse.xtext.resource.XtextResource resource, org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)private voidprovideStringPatternHighlight(org.eclipse.xtext.nodemodel.INode rootNode, org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)Provide the highlighting of the referred variables.
-
-
-
Field Detail
-
COMPLEX_HIGHLIGHT_REGEX
private static final java.lang.String COMPLEX_HIGHLIGHT_REGEX
The regex which identifies the string to be highlighted (within a common string). Example: "Hello ${w} world!" --> identifies: ${w}- See Also:
- Constant Field Values
-
SIMPLE_HIGHLIGHT_REGEX
private static final java.lang.String SIMPLE_HIGHLIGHT_REGEX
The regex which identifies the string to be highlighted (single string). Example: "$target/resources/" --> identifies: $target- See Also:
- Constant Field Values
-
-
Method Detail
-
provideHighlightingFor
public void provideHighlightingFor(org.eclipse.xtext.resource.XtextResource resource, org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)- Specified by:
provideHighlightingForin interfaceorg.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator
-
provideStringPatternHighlight
private void provideStringPatternHighlight(org.eclipse.xtext.nodemodel.INode rootNode, org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)Provide the highlighting of the referred variables. This includes the determination of all strings that match the regular expressions "\\$\\s*\\{\\s*.*?\\s*\\}" or "\\$\\s*.*?/". By default, referred variables will be highlighted in bold. This highlighting may be customized by the user using the VIL/VTL preference page in Eclipse- Parameters:
rootNode- the root node of the parse tree which holds the text of the entire VIL-file.acceptor- the acceptor for adding the positions that should be highlighted individually.
-
hasRootNode
private boolean hasRootNode(org.eclipse.xtext.resource.XtextResource resource)
Check whether the given resource is notnulland provides root-node.- Parameters:
resource- the resource (the actual document in the editor) to be checked.- Returns:
- True if the given resource was parsed successfully and, thus, a root-node exists. False otherwise.
-
-