Class ContentAssistContext
- java.lang.Object
-
- org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext
-
public class ContentAssistContext extends java.lang.ObjectAbstraction of a commonly used set of attributes related to the current content assist request.- Since:
- 2.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContentAssistContext.Builder
-
Constructor Summary
Constructors Modifier Constructor Description protectedContentAssistContext()Protected contructor to allow subclassing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentAssistContext.Buildercopy()Use this context as prototype for a new mutable builder.org.eclipse.emf.ecore.EObjectgetCurrentModel()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.INodegetCurrentNode()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.INodegetLastCompleteNode()The last non-hidden node before the offset that is considered to be complete.intgetOffset()The completion offset in the text viewer.java.lang.StringgetPrefix()The prefix string that is used to match the validity of proposals.org.eclipse.emf.ecore.EObjectgetPreviousModel()The model element that is valid for the position left of the completion offset.intgetReplaceContextLength()The length of the region left to the completion offset that is part of the replace region.org.eclipse.xtext.util.ITextRegiongetReplaceRegion()The region in the document that will be replaced by a new completion proposal.org.eclipse.xtext.resource.XtextResourcegetResource()The resource.org.eclipse.emf.ecore.EObjectgetRootModel()The root model in the resource.org.eclipse.xtext.nodemodel.ICompositeNodegetRootNode()The root node in the resource.java.lang.StringgetSelectedText()The currently selected text.
-
-
-
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 nevernull.
-
getRootModel
public org.eclipse.emf.ecore.EObject getRootModel()
The root model in the resource. May benull.
-
getRootNode
public org.eclipse.xtext.nodemodel.ICompositeNode getRootNode()
The root node in the resource. May benull.
-
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 togetCurrentModel(), 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 nevernull.
-
-