Class 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.ISemanticHighlightingCalculator
    This class enables the customization of syntax-highlighting in the VIL build and template language editors.
    Author:
    dernek, kroeher
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator

        org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator.NewToOldDelegate
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String COMPLEX_HIGHLIGHT_REGEX
      The regex which identifies the string to be highlighted (within a common string).
      private static java.lang.String SIMPLE_HIGHLIGHT_REGEX
      The regex which identifies the string to be highlighted (single string).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean hasRootNode​(org.eclipse.xtext.resource.XtextResource resource)
      Check whether the given resource is not null and provides root-node.
      void provideHighlightingFor​(org.eclipse.xtext.resource.XtextResource resource, org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)  
      private void provideStringPatternHighlight​(org.eclipse.xtext.nodemodel.INode rootNode, org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)
      Provide the highlighting of the referred variables.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • VilHighlightingCalculator

        public VilHighlightingCalculator()
    • Method Detail

      • provideHighlightingFor

        public void provideHighlightingFor​(org.eclipse.xtext.resource.XtextResource resource,
                                           org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor)
        Specified by:
        provideHighlightingFor in interface org.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 not null and 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.