org.eclipse.xtext.xbase.ui.highlighting
Class XbaseHighlightingCalculator

java.lang.Object
  extended by org.eclipse.xtext.xbase.ui.highlighting.XbaseHighlightingCalculator
All Implemented Interfaces:
ISemanticHighlightingCalculator
Direct Known Subclasses:
XtendHighlightingCalculator

public class XbaseHighlightingCalculator
extends java.lang.Object
implements ISemanticHighlightingCalculator

A base implementation of the semantic highlighting calculation.

Highlights references to Primitives, e.g. void, int, boolean and the identifier this.

Author:
Sebastian Zarnekow - Initial contribution and API, Holger Schill

Constructor Summary
XbaseHighlightingCalculator()
           
 
Method Summary
protected  void computeFeatureCallHighlighting(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor)
           
protected  void computeReferencedJvmTypeHighlighting(IHighlightedPositionAcceptor acceptor, org.eclipse.emf.ecore.EObject referencer)
           
protected  void doProvideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor)
           Actual implementation of the semantic highlighting calculation.
protected  void highlightAnnotation(XAnnotation annotation, IHighlightedPositionAcceptor acceptor)
           
protected  void highlightFeatureCall(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor, java.lang.String id)
           
protected  void highlightNode(INode node, java.lang.String id, IHighlightedPositionAcceptor acceptor)
          Highlights the non-hidden parts of node with the style that is associated with id.
protected  void highlightNumberLiterals(XNumberLiteral literal, IHighlightedPositionAcceptor acceptor)
           
protected  void highlightObjectAtFeature(IHighlightedPositionAcceptor acceptor, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String id)
          Highlights an object at the position of the given EStructuralFeature
protected  void highlightReferenceJvmType(IHighlightedPositionAcceptor acceptor, org.eclipse.emf.ecore.EObject referencer, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject resolvedReferencedObject)
           
protected  void highlightSpecialIdentifiers(IHighlightedPositionAcceptor acceptor, ICompositeNode root)
           
protected  void highlightSpecialIdentifiers(ILeafNode leafNode, IHighlightedPositionAcceptor acceptor, TerminalRule idRule)
           
protected  java.util.Map<java.lang.String,java.lang.String> initializeHighlightedIdentifiers()
          Returns a mapping from identifier (e.g.
 void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor)
           
protected  void searchAndHighlightElements(XtextResource resource, IHighlightedPositionAcceptor acceptor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XbaseHighlightingCalculator

public XbaseHighlightingCalculator()
Method Detail

provideHighlightingFor

public void provideHighlightingFor(XtextResource resource,
                                   IHighlightedPositionAcceptor acceptor)
Specified by:
provideHighlightingFor in interface ISemanticHighlightingCalculator
Parameters:
resource - the resource that will be highlighted. May be null in some rare cases.
acceptor - used to announce the mapping from text-range to the style's id. The acceptor will never be null.

doProvideHighlightingFor

protected void doProvideHighlightingFor(XtextResource resource,
                                        IHighlightedPositionAcceptor acceptor)

Actual implementation of the semantic highlighting calculation. It is ensured, that the given resource is not null and refers to an initialized parse result.

Clients should override this method in order to perform custom highlighting.

Parameters:
resource - a valid to-be-processed resource. Is never null.
acceptor - the acceptor. Is never null.

searchAndHighlightElements

protected void searchAndHighlightElements(XtextResource resource,
                                          IHighlightedPositionAcceptor acceptor)

computeReferencedJvmTypeHighlighting

protected void computeReferencedJvmTypeHighlighting(IHighlightedPositionAcceptor acceptor,
                                                    org.eclipse.emf.ecore.EObject referencer)

highlightReferenceJvmType

protected void highlightReferenceJvmType(IHighlightedPositionAcceptor acceptor,
                                         org.eclipse.emf.ecore.EObject referencer,
                                         org.eclipse.emf.ecore.EReference reference,
                                         org.eclipse.emf.ecore.EObject resolvedReferencedObject)

computeFeatureCallHighlighting

protected void computeFeatureCallHighlighting(XAbstractFeatureCall featureCall,
                                              IHighlightedPositionAcceptor acceptor)

highlightFeatureCall

protected void highlightFeatureCall(XAbstractFeatureCall featureCall,
                                    IHighlightedPositionAcceptor acceptor,
                                    java.lang.String id)

highlightAnnotation

protected void highlightAnnotation(XAnnotation annotation,
                                   IHighlightedPositionAcceptor acceptor)

highlightNumberLiterals

protected void highlightNumberLiterals(XNumberLiteral literal,
                                       IHighlightedPositionAcceptor acceptor)

highlightSpecialIdentifiers

protected void highlightSpecialIdentifiers(IHighlightedPositionAcceptor acceptor,
                                           ICompositeNode root)

highlightSpecialIdentifiers

protected void highlightSpecialIdentifiers(ILeafNode leafNode,
                                           IHighlightedPositionAcceptor acceptor,
                                           TerminalRule idRule)

initializeHighlightedIdentifiers

protected java.util.Map<java.lang.String,java.lang.String> initializeHighlightedIdentifiers()
Returns a mapping from identifier (e.g. 'void', 'int', 'this') to highlighting ID. May not return null.

Returns:
a mapping from identifier (e.g. 'void', 'int', 'this') to highlighting ID.

highlightObjectAtFeature

protected void highlightObjectAtFeature(IHighlightedPositionAcceptor acceptor,
                                        org.eclipse.emf.ecore.EObject object,
                                        org.eclipse.emf.ecore.EStructuralFeature feature,
                                        java.lang.String id)
Highlights an object at the position of the given EStructuralFeature


highlightNode

protected void highlightNode(INode node,
                             java.lang.String id,
                             IHighlightedPositionAcceptor acceptor)
Highlights the non-hidden parts of node with the style that is associated with id.