public abstract class AbstractTrace extends java.lang.Object implements ITrace, ITrace.Internal
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractTrace.TraceRegionsByURI |
ITrace.Internal
Constructor and Description |
---|
AbstractTrace() |
Modifier and Type | Method and Description |
---|---|
protected ILocationInResource |
createLocationInResourceFor(ILocationData location,
AbstractTraceRegion traceRegion)
Creates a new location for a target resource that matches the given
location . |
protected AbstractTraceRegion |
doGetRootTraceRegion() |
boolean |
encloses(AbstractTraceRegion region,
int offset,
boolean includeRegionEnd)
Calculate whether the given
region encloses the offset. |
boolean |
encloses(int regionOffset,
int regionLength,
int offset,
boolean includeRegionEnd)
Calculate whether the given
region encloses the offset. |
protected LanguageInfo |
findLanguage(org.eclipse.emf.common.util.URI uri) |
protected AbstractTraceRegion |
findParentByURI(AbstractTraceRegion region,
org.eclipse.emf.common.util.URI uri) |
protected org.eclipse.core.resources.IProject |
findProject(java.lang.String projectName) |
protected abstract org.eclipse.core.resources.IStorage |
findStorage(org.eclipse.emf.common.util.URI uri,
org.eclipse.core.resources.IProject project) |
protected AbstractTraceRegion |
findTraceRegionAt(int offset,
boolean includeRegionEnd) |
AbstractTraceRegion |
findTraceRegionAtLeftOffset(int offset) |
AbstractTraceRegion |
findTraceRegionAtRightOffset(int offset) |
java.lang.Iterable<ILocationInResource> |
getAllAssociatedLocations()
Returns all known associated
locations . |
java.lang.Iterable<ILocationInResource> |
getAllAssociatedLocations(org.eclipse.core.resources.IStorage storage)
Returns all known
locations that were produced from the associated resource
in the given targetResource . |
java.lang.Iterable<ILocationInResource> |
getAllAssociatedLocations(ITextRegion localRegion)
Returns all associated
locations that match the given region . |
java.lang.Iterable<ILocationInResource> |
getAllAssociatedLocations(ITextRegion region,
org.eclipse.core.resources.IStorage storage)
|
protected java.lang.Iterable<AbstractTraceRegion> |
getAllTraceRegions() |
protected java.lang.Iterable<AbstractTraceRegion> |
getAllTraceRegions(ITextRegion localRegion) |
ILocationInResource |
getBestAssociatedLocation(ITextRegion region)
Returns the best associated
location that matches the given region . |
ILocationInResource |
getBestAssociatedLocation(ITextRegion region,
org.eclipse.core.resources.IStorage storage)
|
protected abstract java.io.InputStream |
getContents(org.eclipse.emf.common.util.URI uri,
org.eclipse.core.resources.IProject project) |
LanguageInfo |
getLanguage()
Returns the language that is associated with the source resource.
|
abstract org.eclipse.core.resources.IProject |
getLocalProject()
Returns the source project.
|
abstract org.eclipse.emf.common.util.URI |
getLocalURI()
Returns the URI of the source resource.
|
protected ILocationInResource |
getMergedLocationInResource(AbstractTraceRegion region) |
protected org.eclipse.emf.ecore.resource.Resource |
getResource(org.eclipse.emf.common.util.URI uri,
org.eclipse.core.resources.IProject project) |
AbstractTraceRegion |
getRootTraceRegion()
Returns the root trace region where
AbstractStatefulTraceRegion.getMyOffset() and
AbstractStatefulTraceRegion.getMyLength() return the information for the
resource that this ITrace is associated with. |
protected <T> T |
getService(org.eclipse.emf.common.util.URI uri,
java.lang.Class<T> type) |
protected IStorage2UriMapper |
getStorage2uriMapper() |
protected ITraceRegionProvider |
getTraceRegionProvider() |
protected org.eclipse.emf.common.util.URI |
getURIForStorage(org.eclipse.core.resources.IStorage storage) |
protected org.eclipse.core.resources.IWorkspace |
getWorkspace() |
protected boolean |
isAssociatedWith(AbstractTraceRegion region,
org.eclipse.emf.common.util.URI uri) |
protected ILocationInResource |
mergeRegions(AbstractTraceRegion left,
AbstractTraceRegion right) |
protected org.eclipse.emf.common.util.URI |
resolvePath(org.eclipse.emf.common.util.URI path) |
protected void |
setTraceRegionProvider(ITraceRegionProvider traceRegionProvider) |
protected java.lang.Iterable<ILocationInResource> |
toLocations(java.lang.Iterable<AbstractTraceRegion> allTraceRegions) |
protected IStorage2UriMapper getStorage2uriMapper()
public final AbstractTraceRegion getRootTraceRegion()
AbstractStatefulTraceRegion.getMyOffset()
and
AbstractStatefulTraceRegion.getMyLength()
return the information for the
resource that this ITrace
is associated with.getRootTraceRegion
in interface ITrace.Internal
null
if no trace data is available.protected AbstractTraceRegion doGetRootTraceRegion()
protected void setTraceRegionProvider(ITraceRegionProvider traceRegionProvider)
protected ITraceRegionProvider getTraceRegionProvider()
public ILocationInResource getBestAssociatedLocation(ITextRegion region)
ITrace
location
that matches the given region
.
If the region does not match a single location, the following strategy applies:
null
is returned.
null
.getBestAssociatedLocation
in interface ITrace
region
- the region in the current resource. May not be null
.null
if none.protected ILocationInResource mergeRegions(AbstractTraceRegion left, AbstractTraceRegion right)
protected ILocationInResource getMergedLocationInResource(AbstractTraceRegion region)
protected ILocationInResource createLocationInResourceFor(ILocationData location, AbstractTraceRegion traceRegion)
location
.location
- the locationnull
detecting a path fails.protected org.eclipse.emf.common.util.URI resolvePath(org.eclipse.emf.common.util.URI path)
public AbstractTraceRegion findTraceRegionAtRightOffset(int offset)
protected AbstractTraceRegion findTraceRegionAt(int offset, boolean includeRegionEnd)
public AbstractTraceRegion findTraceRegionAtLeftOffset(int offset)
public boolean encloses(AbstractTraceRegion region, int offset, boolean includeRegionEnd)
region
encloses the offset.region
- the region to be checked. May not be null
.offset
- the offset that should be enclosed by the region.includeRegionEnd
- whether a region is enclosing the offset if it ends at that location.true if the given region encloses the offset.
public boolean encloses(int regionOffset, int regionLength, int offset, boolean includeRegionEnd)
region
encloses the offset.regionOffset
- the start of the region that should be checked.regionLength
- the length of the region that should be checked.offset
- the offset that should be enclosed by the region.includeRegionEnd
- whether a region is enclosing the offset if it ends at that location.true if the given region encloses the offset.
public java.lang.Iterable<ILocationInResource> getAllAssociatedLocations(ITextRegion localRegion)
ITrace
locations
that match the given region
.getAllAssociatedLocations
in interface ITrace
localRegion
- the region in the current resource. May not be null
.null
.public ILocationInResource getBestAssociatedLocation(ITextRegion region, org.eclipse.core.resources.IStorage storage)
ITrace
location
that matches the given
sourceRegion
in the targetResource
.
If the region does not match a single location in the target, the following strategy applies:
targetResource
is returned.
sourceRegion
does not yield
a location in targetResource
, returns null
.getBestAssociatedLocation
in interface ITrace
region
- the region in the current resource. May not be null
.storage
- the expected target resource. May not be null
.null
if none.protected boolean isAssociatedWith(AbstractTraceRegion region, org.eclipse.emf.common.util.URI uri)
protected AbstractTraceRegion findParentByURI(AbstractTraceRegion region, org.eclipse.emf.common.util.URI uri)
public java.lang.Iterable<ILocationInResource> getAllAssociatedLocations(ITextRegion region, org.eclipse.core.resources.IStorage storage)
ITrace
getAllAssociatedLocations
in interface ITrace
region
- the region in the current resource. May not be null
.storage
- the expected target resource. May not be null
.null
.public java.lang.Iterable<ILocationInResource> getAllAssociatedLocations(org.eclipse.core.resources.IStorage storage)
ITrace
locations
that were produced from the associated resource
in the given targetResource
.getAllAssociatedLocations
in interface ITrace
storage
- the expected target resource. May not be null
.null
.public LanguageInfo getLanguage()
ITrace
null
.getLanguage
in interface ITrace
null
.public abstract org.eclipse.emf.common.util.URI getLocalURI()
ITrace
null
.getLocalURI
in interface ITrace
null
.protected org.eclipse.emf.common.util.URI getURIForStorage(org.eclipse.core.resources.IStorage storage)
public abstract org.eclipse.core.resources.IProject getLocalProject()
ITrace
null
.getLocalProject
in interface ITrace
null
.protected java.lang.Iterable<ILocationInResource> toLocations(java.lang.Iterable<AbstractTraceRegion> allTraceRegions)
protected java.lang.Iterable<AbstractTraceRegion> getAllTraceRegions(ITextRegion localRegion)
public java.lang.Iterable<ILocationInResource> getAllAssociatedLocations()
ITrace
locations
.getAllAssociatedLocations
in interface ITrace
null
.protected java.lang.Iterable<AbstractTraceRegion> getAllTraceRegions()
protected org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri, org.eclipse.core.resources.IProject project)
protected abstract org.eclipse.core.resources.IStorage findStorage(org.eclipse.emf.common.util.URI uri, org.eclipse.core.resources.IProject project)
protected abstract java.io.InputStream getContents(org.eclipse.emf.common.util.URI uri, org.eclipse.core.resources.IProject project) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
protected org.eclipse.core.resources.IProject findProject(java.lang.String projectName)
protected org.eclipse.core.resources.IWorkspace getWorkspace()
protected LanguageInfo findLanguage(org.eclipse.emf.common.util.URI uri)
protected <T> T getService(org.eclipse.emf.common.util.URI uri, java.lang.Class<T> type)