Class DefaultDocumentHighlightService
- java.lang.Object
-
- org.eclipse.xtext.ide.server.occurrences.DefaultDocumentHighlightService
-
- All Implemented Interfaces:
IDocumentHighlightService
public class DefaultDocumentHighlightService extends java.lang.Object implements IDocumentHighlightService
Default implementation of thedocument highlight service.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.xtext.resource.ILocationInFileProviderlocationInFileProviderprotected org.eclipse.xtext.resource.EObjectAtOffsetHelperoffsetHelperprotected ITextRegionTransformertextRegionTransformer
-
Constructor Summary
Constructors Constructor Description DefaultDocumentHighlightService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<? extends org.eclipse.lsp4j.DocumentHighlight>getDocumentHighlights(Document document, org.eclipse.xtext.resource.XtextResource resource, org.eclipse.lsp4j.DocumentHighlightParams params, org.eclipse.xtext.util.CancelIndicator cancelIndicator)java.util.List<org.eclipse.lsp4j.DocumentHighlight>getDocumentHighlights(org.eclipse.xtext.resource.XtextResource resource, int offset)protected com.google.common.base.Predicate<org.eclipse.emf.ecore.EObject>getSelectedElementFilter()Returns with a filter that is used to ignore elements at a given offset.protected java.lang.Iterable<org.eclipse.emf.common.util.URI>getTargetURIs(org.eclipse.emf.ecore.EObject primaryTarget)Returns with an iterable of URIs that points to all elements that are referenced by the argument or vice-versa.protected booleanisDocumentHighlightAvailableFor(org.eclipse.emf.ecore.EObject selectedElement, org.eclipse.xtext.resource.XtextResource resource, int offset)Returns withtrueif the AST element selected from the resource can provide document highlights, otherwise returns withfalse.protected booleanisNullOrEmpty(org.eclipse.xtext.util.ITextRegion region)Returnstrueif the argument is eithernullorempty.
-
-
-
Field Detail
-
offsetHelper
@Inject protected org.eclipse.xtext.resource.EObjectAtOffsetHelper offsetHelper
-
locationInFileProvider
@Inject protected org.eclipse.xtext.resource.ILocationInFileProvider locationInFileProvider
-
textRegionTransformer
@Inject protected ITextRegionTransformer textRegionTransformer
-
-
Method Detail
-
getDocumentHighlights
public java.util.List<? extends org.eclipse.lsp4j.DocumentHighlight> getDocumentHighlights(Document document, org.eclipse.xtext.resource.XtextResource resource, org.eclipse.lsp4j.DocumentHighlightParams params, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
- Specified by:
getDocumentHighlightsin interfaceIDocumentHighlightService
-
getDocumentHighlights
public java.util.List<org.eclipse.lsp4j.DocumentHighlight> getDocumentHighlights(org.eclipse.xtext.resource.XtextResource resource, int offset)
-
isDocumentHighlightAvailableFor
protected boolean isDocumentHighlightAvailableFor(org.eclipse.emf.ecore.EObject selectedElement, org.eclipse.xtext.resource.XtextResource resource, int offset)Returns withtrueif the AST element selected from the resource can provide document highlights, otherwise returns withfalse.Clients may override this method to change the default behavior.
- Parameters:
selectedElement- the selected element resolved via the offset from the resource. Can benull.resource- the resource for the document.offset- the offset of the selection.- Returns:
trueif the document highlight is available for the selected element, otherwisefalse.
-
getSelectedElementFilter
protected com.google.common.base.Predicate<org.eclipse.emf.ecore.EObject> getSelectedElementFilter()
Returns with a filter that is used to ignore elements at a given offset.By default returns with a filter that skips all
EObjectinstances that have noeContainer().- Returns:
- a function that will be used to skip elements selected on the given offset.
-
getTargetURIs
protected java.lang.Iterable<org.eclipse.emf.common.util.URI> getTargetURIs(org.eclipse.emf.ecore.EObject primaryTarget)
Returns with an iterable of URIs that points to all elements that are referenced by the argument or vice-versa.- Returns:
- an iterable of URIs that are referenced by the argument or the other way around.
-
isNullOrEmpty
protected boolean isNullOrEmpty(org.eclipse.xtext.util.ITextRegion region)
Returnstrueif the argument is eithernullorempty. Otherwise returns withfalse.- Returns:
trueif the argument is eithernullor empty.
-
-