Class DefaultSemanticHighlightingCalculator
- java.lang.Object
-
- org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator
-
- All Implemented Interfaces:
ISemanticHighlightingCalculator
public class DefaultSemanticHighlightingCalculator extends java.lang.Object implements ISemanticHighlightingCalculator
- Since:
- 2.9
-
-
Constructor Summary
Constructors Constructor Description DefaultSemanticHighlightingCalculator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoProvideHighlightingFor(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)Actual implementation of the semantic highlighting calculation.protected booleanhighlightElement(org.eclipse.emf.ecore.EObject object, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)protected voidhighlightElementRecursively(org.eclipse.emf.ecore.EObject element, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)protected voidhighlightFeature(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 givenEStructuralFeatureprotected voidhighlightNode(IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.nodemodel.INode node, java.lang.String... styleIds)Highlights the non-hidden parts ofnodewith the styles given by thestyleIdsprotected voidhighlightTasks(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor)voidprovideHighlightingFor(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)protected voidsearchAndHighlightElements(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
-
-
-
Method Detail
-
provideHighlightingFor
public void provideHighlightingFor(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)- Specified by:
provideHighlightingForin interfaceISemanticHighlightingCalculator- Parameters:
resource- the resource that will be highlighted. May benullin some rare cases.acceptor- used to announce the mapping from text-range to the style's id. The acceptor will never benull.cancelIndicator- used to determine whether we should stop searching for highlighting positions (useOperationCanceledManagerto check)
-
doProvideHighlightingFor
protected void doProvideHighlightingFor(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)Actual implementation of the semantic highlighting calculation. It is ensured, that the given resource is not
nulland refers to an initialized parse result.By default this will visit the elements in the resource recursively and call
highlightElement(EObject, IHighlightedPositionAcceptor, CancelIndicator)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
- Parameters:
resource- a valid to-be-processed resource. Is nevernull.acceptor- the acceptor. Is nevernull.
-
searchAndHighlightElements
protected void searchAndHighlightElements(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
-
highlightElementRecursively
protected void highlightElementRecursively(org.eclipse.emf.ecore.EObject element, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
-
highlightElement
protected boolean highlightElement(org.eclipse.emf.ecore.EObject object, IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.util.CancelIndicator cancelIndicator)- Returns:
- true to skip the children of this element, false otherwise
-
highlightTasks
protected void highlightTasks(org.eclipse.xtext.resource.XtextResource resource, IHighlightedPositionAcceptor acceptor)
-
highlightFeature
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 givenEStructuralFeature
-
highlightNode
protected void highlightNode(IHighlightedPositionAcceptor acceptor, org.eclipse.xtext.nodemodel.INode node, java.lang.String... styleIds)
Highlights the non-hidden parts ofnodewith the styles given by thestyleIds
-
-