org.eclipse.xtext.resource
Class EObjectAtOffsetHelper

java.lang.Object
  extended by org.eclipse.xtext.resource.EObjectAtOffsetHelper

public class EObjectAtOffsetHelper
extends java.lang.Object

Author:
Jan Koehnlein - Initial contribution and API, Holger Schill

Constructor Summary
EObjectAtOffsetHelper()
           
 
Method Summary
protected  INode findCrossReferenceNode(INode node)
           
 org.eclipse.emf.ecore.EObject getCrossReferencedElement(INode node)
           
 INode getCrossReferenceNode(XtextResource resource, ITextRegion region)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EObjectAtOffsetHelper

public EObjectAtOffsetHelper()
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,
                                   ITextRegion region)
Since:
2.1

getCrossReferencedElement

public org.eclipse.emf.ecore.EObject getCrossReferencedElement(INode node)
Parameters:
node - a node with an associated CrossReference 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)