Class EObjectAtOffsetHelper


  • public class EObjectAtOffsetHelper
    extends java.lang.Object
    • 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,
                                           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 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)
      • 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 return null if the given offset is not valid or if such an object cannot be found at the given offset.
        Parameters:
        resource - the XtextResource May be null.
        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