Package org.eclipse.xtext.resource
Class EObjectAtOffsetHelper
- java.lang.Object
-
- org.eclipse.xtext.resource.EObjectAtOffsetHelper
-
public class EObjectAtOffsetHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description EObjectAtOffsetHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected INode
findCrossReferenceNode(INode node)
org.eclipse.emf.ecore.EObject
getCrossReferencedElement(INode node)
INode
getCrossReferenceNode(XtextResource resource, org.eclipse.xtext.util.ITextRegion region)
org.eclipse.emf.ecore.EObject
getElementWithNameAt(XtextResource resource, int offset)
Find the leaf node at the given offset that defines a named element or cross-references to such an element.protected org.eclipse.emf.ecore.EObject
internalResolveElementAt(XtextResource resource, int offset, boolean containment)
protected boolean
isElementOfDatatypeRule(org.eclipse.emf.ecore.EObject grammarElement)
org.eclipse.emf.ecore.EObject
resolveContainedElementAt(XtextResource resource, int offset)
protected org.eclipse.emf.ecore.EObject
resolveCrossReferencedElement(INode node)
org.eclipse.emf.ecore.EObject
resolveCrossReferencedElementAt(XtextResource resource, int offset)
org.eclipse.emf.ecore.EObject
resolveElementAt(XtextResource resource, int offset)
-
-
-
Method Detail
-
resolveElementAt
public org.eclipse.emf.ecore.EObject resolveElementAt(XtextResource resource, int offset)
- Returns:
- the declared or the referenced element next to the offset
-
resolveContainedElementAt
public org.eclipse.emf.ecore.EObject resolveContainedElementAt(XtextResource resource, int offset)
- Returns:
- the declared element next to the offset
- Since:
- 2.3
-
resolveCrossReferencedElementAt
public org.eclipse.emf.ecore.EObject resolveCrossReferencedElementAt(XtextResource resource, int offset)
- Returns:
- the cross referenced EObject under, right or left to the cursor (in that order) or
null
if there is no cross referenced object next to the offset.
-
getCrossReferenceNode
public INode getCrossReferenceNode(XtextResource resource, org.eclipse.xtext.util.ITextRegion region)
- Since:
- 2.1
-
getCrossReferencedElement
public org.eclipse.emf.ecore.EObject getCrossReferencedElement(INode node)
- Parameters:
node
- a node with an associatedCrossReference
grammar element.- Returns:
- the
EObject
referenced by this node - Since:
- 2.1
-
findCrossReferenceNode
protected INode findCrossReferenceNode(INode node)
- Parameters:
node
- a node (possibly null)- Returns:
- if the given node is part of a cross reference this method returns the node pointing to the
CrossReference
null
if the passed node was a null reference or if the passed node is not part of a cross reference. - Since:
- 2.1
-
isElementOfDatatypeRule
protected boolean isElementOfDatatypeRule(org.eclipse.emf.ecore.EObject grammarElement)
- Since:
- 2.1
-
internalResolveElementAt
protected org.eclipse.emf.ecore.EObject internalResolveElementAt(XtextResource resource, int offset, boolean containment)
-
resolveCrossReferencedElement
protected org.eclipse.emf.ecore.EObject resolveCrossReferencedElement(INode node)
-
getElementWithNameAt
public org.eclipse.emf.ecore.EObject getElementWithNameAt(XtextResource resource, int offset)
Find the leaf node at the given offset that defines a named element or cross-references to such an element. May returnnull
if the given offset is not valid or if such an object cannot be found at the given offset.- Parameters:
resource
- theXtextResource
May benull
.offset
- the offset where the leaf node is to be searched.- Returns:
- the leaf node with an identifier at the given offset or
null
. - Since:
- 2.28
-
-