Class ContentAssistContext


  • public class ContentAssistContext
    extends java.lang.Object
    Abstraction of a commonly used set of attributes related to the current content assist request.
    Since:
    2.9
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ContentAssistContext()
      Protected contructor to allow subclassing.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ContentAssistContext.Builder copy()
      Use this context as prototype for a new mutable builder.
      org.eclipse.emf.ecore.EObject getCurrentModel()
      The model that covers the completion offset and has a grammar element assigned that has the expected grammar element at the given offset in its call hierarchy.
      org.eclipse.xtext.nodemodel.INode getCurrentNode()
      The current node which is part of the current completion offset.
      com.google.common.collect.ImmutableList<org.eclipse.xtext.AbstractElement> getFirstSetGrammarElements()
      The grammar elements that may occur at the given offset.
      org.eclipse.xtext.nodemodel.INode getLastCompleteNode()
      The last non-hidden node before the offset that is considered to be complete.
      int getOffset()
      The completion offset in the text viewer.
      java.lang.String getPrefix()
      The prefix string that is used to match the validity of proposals.
      org.eclipse.emf.ecore.EObject getPreviousModel()
      The model element that is valid for the position left of the completion offset.
      int getReplaceContextLength()
      The length of the region left to the completion offset that is part of the replace region.
      org.eclipse.xtext.util.ITextRegion getReplaceRegion()
      The region in the document that will be replaced by a new completion proposal.
      org.eclipse.xtext.resource.XtextResource getResource()
      The resource.
      org.eclipse.emf.ecore.EObject getRootModel()
      The root model in the resource.
      org.eclipse.xtext.nodemodel.ICompositeNode getRootNode()
      The root node in the resource.
      java.lang.String getSelectedText()
      The currently selected text.
      • Methods inherited from class java.lang.Object

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

      • ContentAssistContext

        protected ContentAssistContext()
        Protected contructor to allow subclassing.
    • Method Detail

      • copy

        public ContentAssistContext.Builder copy()
        Use this context as prototype for a new mutable builder. The new builder is pre-populated with the current settings of this context instance.
      • getPrefix

        public java.lang.String getPrefix()
        The prefix string that is used to match the validity of proposals. By default, the complete prefix will be overridden in the document when a proposal is applied. The prefix may be empty but is never null.
      • getRootModel

        public org.eclipse.emf.ecore.EObject getRootModel()
        The root model in the resource. May be null.
      • getRootNode

        public org.eclipse.xtext.nodemodel.ICompositeNode getRootNode()
        The root node in the resource. May be null.
      • getCurrentNode

        public org.eclipse.xtext.nodemodel.INode getCurrentNode()
        The current node which is part of the current completion offset. The total offset of the current node may be equal to the completion offset.
      • getOffset

        public int getOffset()
        The completion offset in the text viewer. If the text viewer has a non-empty text selection, the offset will be the beginning of the selection.
      • getLastCompleteNode

        public org.eclipse.xtext.nodemodel.INode getLastCompleteNode()
        The last non-hidden node before the offset that is considered to be complete.
      • getCurrentModel

        public org.eclipse.emf.ecore.EObject getCurrentModel()
        The model that covers the completion offset and has a grammar element assigned that has the expected grammar element at the given offset in its call hierarchy. Thereby it may be a parent of the actual model element at the given offset due to alternative decisions of the parser or actions.
        See Also:
        getPreviousModel()
      • getPreviousModel

        public org.eclipse.emf.ecore.EObject getPreviousModel()
        The model element that is valid for the position left of the completion offset. It is likely to be the same as the current model. However, as the call hierarchy of the grammar elements is ignored (in contrast to getCurrentModel(), it may provide addition information.
        See Also:
        getCurrentModel()
      • getReplaceRegion

        public org.eclipse.xtext.util.ITextRegion getReplaceRegion()
        The region in the document that will be replaced by a new completion proposal.
      • getSelectedText

        public java.lang.String getSelectedText()
        The currently selected text.
      • getFirstSetGrammarElements

        public com.google.common.collect.ImmutableList<org.eclipse.xtext.AbstractElement> getFirstSetGrammarElements()
        The grammar elements that may occur at the given offset.
      • getReplaceContextLength

        public int getReplaceContextLength()
        The length of the region left to the completion offset that is part of the replace region.
      • getResource

        public org.eclipse.xtext.resource.XtextResource getResource()
        The resource. Is never null.