public class DefaultSemanticHighlightingCalculator extends java.lang.Object implements ISemanticHighlightingCalculator
Constructor and Description |
---|
DefaultSemanticHighlightingCalculator() |
Modifier and Type | Method and Description |
---|---|
protected void |
doProvideHighlightingFor(XtextResource resource,
IHighlightedPositionAcceptor acceptor)
Actual implementation of the semantic highlighting calculation.
|
protected boolean |
highlightElement(org.eclipse.emf.ecore.EObject object,
IHighlightedPositionAcceptor acceptor) |
protected void |
highlightElementRecursively(org.eclipse.emf.ecore.EObject element,
IHighlightedPositionAcceptor acceptor) |
protected void |
highlightFeature(IHighlightedPositionAcceptor acceptor,
org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EStructuralFeature feature,
java.lang.String... styleIds)
Highlights an object at the position of the given
EStructuralFeature |
protected void |
highlightNode(IHighlightedPositionAcceptor acceptor,
INode node,
java.lang.String... styleIds)
Highlights the non-hidden parts of
node with the styles given by the styleIds |
protected void |
highlightTasks(XtextResource resource,
IHighlightedPositionAcceptor acceptor) |
void |
provideHighlightingFor(XtextResource resource,
IHighlightedPositionAcceptor acceptor) |
protected void |
searchAndHighlightElements(XtextResource resource,
IHighlightedPositionAcceptor acceptor) |
public DefaultSemanticHighlightingCalculator()
public void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor)
provideHighlightingFor
in interface ISemanticHighlightingCalculator
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
.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.
By default this will visit the elements in the resource recursively and call
highlightElement(EObject, IHighlightedPositionAcceptor)
for each of them. As the last step, tasks will
be highlighted.
Clients can override this method if the default recursive approach does not fit their use case
resource
- a valid to-be-processed resource. Is never null
.acceptor
- the acceptor. Is never null
.protected void searchAndHighlightElements(XtextResource resource, IHighlightedPositionAcceptor acceptor)
protected void highlightElementRecursively(org.eclipse.emf.ecore.EObject element, IHighlightedPositionAcceptor acceptor)
protected boolean highlightElement(org.eclipse.emf.ecore.EObject object, IHighlightedPositionAcceptor acceptor)
protected void highlightTasks(XtextResource resource, IHighlightedPositionAcceptor acceptor)
protected void highlightFeature(IHighlightedPositionAcceptor acceptor, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String... styleIds)
EStructuralFeature
protected void highlightNode(IHighlightedPositionAcceptor acceptor, INode node, java.lang.String... styleIds)
node
with the styles given by the styleIds