Class 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 boolean isDocumentHighlightAvailableFor​(org.eclipse.emf.ecore.EObject selectedElement, org.eclipse.xtext.resource.XtextResource resource, int offset)
      Returns with true if the AST element selected from the resource can provide document highlights, otherwise returns with false.
      protected boolean isNullOrEmpty​(org.eclipse.xtext.util.ITextRegion region)
      Returns true if the argument is either null or empty.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • offsetHelper

        @Inject
        protected org.eclipse.xtext.resource.EObjectAtOffsetHelper offsetHelper
      • locationInFileProvider

        @Inject
        protected org.eclipse.xtext.resource.ILocationInFileProvider locationInFileProvider
    • Constructor Detail

      • DefaultDocumentHighlightService

        public DefaultDocumentHighlightService()
    • 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:
        getDocumentHighlights in interface IDocumentHighlightService
      • 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 with true if the AST element selected from the resource can provide document highlights, otherwise returns with false.

        Clients may override this method to change the default behavior.

        Parameters:
        selectedElement - the selected element resolved via the offset from the resource. Can be null.
        resource - the resource for the document.
        offset - the offset of the selection.
        Returns:
        true if the document highlight is available for the selected element, otherwise false.
      • 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 EObject instances that have no eContainer().

        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)
        Returns true if the argument is either null or empty. Otherwise returns with false.
        Returns:
        true if the argument is either null or empty.