org.eclipse.xtext.resource
Class DefaultLocationInFileProvider

java.lang.Object
  extended by org.eclipse.xtext.resource.DefaultLocationInFileProvider
All Implemented Interfaces:
ILocationInFileProvider, ILocationInFileProviderExtension
Direct Known Subclasses:
XbaseLocationInFileProvider, XtextLocationInFileProvider

public class DefaultLocationInFileProvider
extends java.lang.Object
implements ILocationInFileProvider, ILocationInFileProviderExtension

Author:
Peter Friese - Implementation, Sven Efftinge - Initial contribution and API

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.ILocationInFileProviderExtension
ILocationInFileProviderExtension.RegionDescription
 
Constructor Summary
DefaultLocationInFileProvider()
           
 
Method Summary
protected  ITextRegion createRegion(java.util.List<INode> nodes)
           
protected  ITextRegion createRegion(java.util.List<INode> nodes, ILocationInFileProviderExtension.RegionDescription query)
           
protected  ITextRegion doGetLocationOfFeature(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EStructuralFeature feature, int indexInList, boolean isSignificant)
           
protected  ITextRegion doGetLocationOfFeature(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EStructuralFeature feature, int indexInList, ILocationInFileProviderExtension.RegionDescription query)
           
protected  ITextRegion doGetTextRegion(org.eclipse.emf.ecore.EObject obj, ILocationInFileProviderExtension.RegionDescription query)
           
protected  ICompositeNode findNodeFor(org.eclipse.emf.ecore.EObject semanticObject)
          Returns the smallest node that covers all assigned values of the given object.
 ITextRegion getFullTextRegion(org.eclipse.emf.ecore.EObject obj)
           
 ITextRegion getFullTextRegion(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EStructuralFeature feature, int indexInList)
           
protected  org.eclipse.emf.ecore.EStructuralFeature getIdentifierFeature(org.eclipse.emf.ecore.EObject obj)
           
protected  java.util.List<INode> getLocationNodes(org.eclipse.emf.ecore.EObject obj)
           
protected  ITextRegion getLocationOfAttribute(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EAttribute attribute, int indexInList, boolean isSignificant)
           
protected  ITextRegion getLocationOfContainmentReference(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference feature, int indexInList, boolean isSignificant)
           
protected  ITextRegion getLocationOfContainmentReference(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference feature, int indexInList, ILocationInFileProviderExtension.RegionDescription query)
           
protected  ITextRegion getLocationOfCrossReference(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference, int indexInList, boolean isSignificant)
           
 ITextRegion getSignificantTextRegion(org.eclipse.emf.ecore.EObject obj)
           
 ITextRegion getSignificantTextRegion(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EStructuralFeature feature, int indexInList)
           
protected  ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject obj, boolean isSignificant)
           
 ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int indexInList, ILocationInFileProviderExtension.RegionDescription query)
          Queries for parts of the text region that parts of the given object originate from.
 ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject object, ILocationInFileProviderExtension.RegionDescription query)
          Queries for parts of the text region that the given object is originates from.
protected  boolean isHidden(INode node)
           
protected  boolean isHidden(INode node, ILocationInFileProviderExtension.RegionDescription query)
           
protected  boolean useKeyword(Keyword keyword, org.eclipse.emf.ecore.EObject context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocationInFileProvider

public DefaultLocationInFileProvider()
Method Detail

getSignificantTextRegion

public ITextRegion getSignificantTextRegion(org.eclipse.emf.ecore.EObject obj)
Specified by:
getSignificantTextRegion in interface ILocationInFileProvider

getFullTextRegion

public ITextRegion getFullTextRegion(org.eclipse.emf.ecore.EObject obj)
Specified by:
getFullTextRegion in interface ILocationInFileProvider

getTextRegion

protected ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject obj,
                                    boolean isSignificant)

getTextRegion

@Nullable
public ITextRegion getTextRegion(@NonNull
                                          org.eclipse.emf.ecore.EObject object,
                                          @NonNull
                                          ILocationInFileProviderExtension.RegionDescription query)
Description copied from interface: ILocationInFileProviderExtension
Queries for parts of the text region that the given object is originates from.

Specified by:
getTextRegion in interface ILocationInFileProviderExtension
Parameters:
object - the instance whose region should be returned.
query - the hint about the requested range.
Returns:
the text region or null if the object does not have an associated text region.
Since:
2.3

doGetTextRegion

protected ITextRegion doGetTextRegion(org.eclipse.emf.ecore.EObject obj,
                                      @NonNull
                                      ILocationInFileProviderExtension.RegionDescription query)
Since:
2.3

getSignificantTextRegion

public ITextRegion getSignificantTextRegion(org.eclipse.emf.ecore.EObject owner,
                                            org.eclipse.emf.ecore.EStructuralFeature feature,
                                            int indexInList)
Specified by:
getSignificantTextRegion in interface ILocationInFileProvider

getFullTextRegion

public ITextRegion getFullTextRegion(org.eclipse.emf.ecore.EObject owner,
                                     org.eclipse.emf.ecore.EStructuralFeature feature,
                                     int indexInList)
Specified by:
getFullTextRegion in interface ILocationInFileProvider

getTextRegion

@NonNullByDefault
@Nullable
public ITextRegion getTextRegion(org.eclipse.emf.ecore.EObject object,
                                                           org.eclipse.emf.ecore.EStructuralFeature feature,
                                                           int indexInList,
                                                           ILocationInFileProviderExtension.RegionDescription query)
Description copied from interface: ILocationInFileProviderExtension
Queries for parts of the text region that parts of the given object originate from.

Specified by:
getTextRegion in interface ILocationInFileProviderExtension
Parameters:
object - the instance whose region should be returned.
feature - the feature that was set when the requested range was consumed by the parser.
indexInList - the index in the list of feature values. -1 if all values should be considered.
query - the hint about the requested range.
Returns:
the text region or null if the object does not have an associated text region.
Since:
2.3

getLocationOfContainmentReference

protected ITextRegion getLocationOfContainmentReference(org.eclipse.emf.ecore.EObject owner,
                                                        org.eclipse.emf.ecore.EReference feature,
                                                        int indexInList,
                                                        boolean isSignificant)

getLocationOfContainmentReference

protected ITextRegion getLocationOfContainmentReference(org.eclipse.emf.ecore.EObject owner,
                                                        org.eclipse.emf.ecore.EReference feature,
                                                        int indexInList,
                                                        ILocationInFileProviderExtension.RegionDescription query)
Since:
2.3

getLocationOfCrossReference

protected ITextRegion getLocationOfCrossReference(org.eclipse.emf.ecore.EObject owner,
                                                  org.eclipse.emf.ecore.EReference reference,
                                                  int indexInList,
                                                  boolean isSignificant)

getLocationOfAttribute

protected ITextRegion getLocationOfAttribute(org.eclipse.emf.ecore.EObject owner,
                                             org.eclipse.emf.ecore.EAttribute attribute,
                                             int indexInList,
                                             boolean isSignificant)

doGetLocationOfFeature

protected ITextRegion doGetLocationOfFeature(org.eclipse.emf.ecore.EObject owner,
                                             org.eclipse.emf.ecore.EStructuralFeature feature,
                                             int indexInList,
                                             boolean isSignificant)

doGetLocationOfFeature

protected ITextRegion doGetLocationOfFeature(org.eclipse.emf.ecore.EObject owner,
                                             org.eclipse.emf.ecore.EStructuralFeature feature,
                                             int indexInList,
                                             ILocationInFileProviderExtension.RegionDescription query)
Since:
2.3

getLocationNodes

protected java.util.List<INode> getLocationNodes(org.eclipse.emf.ecore.EObject obj)

useKeyword

protected boolean useKeyword(Keyword keyword,
                             org.eclipse.emf.ecore.EObject context)

getIdentifierFeature

protected org.eclipse.emf.ecore.EStructuralFeature getIdentifierFeature(org.eclipse.emf.ecore.EObject obj)

createRegion

protected ITextRegion createRegion(java.util.List<INode> nodes)

createRegion

protected ITextRegion createRegion(java.util.List<INode> nodes,
                                   ILocationInFileProviderExtension.RegionDescription query)
Since:
2.3

isHidden

protected boolean isHidden(INode node,
                           ILocationInFileProviderExtension.RegionDescription query)
Since:
2.3

isHidden

protected boolean isHidden(INode node)

findNodeFor

protected ICompositeNode findNodeFor(org.eclipse.emf.ecore.EObject semanticObject)
Returns the smallest node that covers all assigned values of the given object. It handles the semantics of actions and unassigned rule calls.

Returns:
the minimal node that covers all assigned values of the given object.
Since:
2.3