|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.PlatformObject
org.eclipse.core.resources.mapping.ResourceMapping
public abstract class ResourceMapping
A resource mapping supports the transformation of an application model object into its underlying file system resources. It provides the bridge between a logical element and the physical resource(s) into which it is stored but does not provide more comprehensive model access or manipulations.
Mappings provide two means of model traversal. The accept(org.eclipse.core.resources.mapping.ResourceMappingContext, org.eclipse.core.resources.IResourceVisitor, org.eclipse.core.runtime.IProgressMonitor)
method
can be used to visit the resources that constitute the model object. Alternatively,
a set or traversals can be obtained by calling getTraversals(org.eclipse.core.resources.mapping.ResourceMappingContext, org.eclipse.core.runtime.IProgressMonitor)
. A traversal
contains a set of resources and a depth. This allows clients (such a repository providers)
to do optimal traversals of the resources w.r.t. the operation that is being performed
on the model object.
This class may be subclassed by clients.
IResource
,
ResourceTraversal
Constructor Summary | |
---|---|
ResourceMapping()
|
Method Summary | |
---|---|
void |
accept(ResourceMappingContext context,
IResourceVisitor visitor,
org.eclipse.core.runtime.IProgressMonitor monitor)
Accepts the given visitor for all existing resources in this mapping. |
boolean |
contains(ResourceMapping mapping)
Return whether this resource mapping contains all the resources of the given mapping. |
boolean |
equals(java.lang.Object obj)
Override equals to compare the model objects of the mapping in order to determine equality. |
IMarker[] |
findMarkers(java.lang.String type,
boolean includeSubtypes,
org.eclipse.core.runtime.IProgressMonitor monitor)
Returns all markers of the specified type on the resources in this mapping. |
abstract java.lang.Object |
getModelObject()
Returns the application model element associated with this resource mapping. |
ModelProvider |
getModelProvider()
Return the model provider for the model object of this resource mapping. |
abstract java.lang.String |
getModelProviderId()
Returns the id of the model provider that generated this resource mapping. |
abstract IProject[] |
getProjects()
Returns the projects that contain the resources that constitute this application model. |
abstract ResourceTraversal[] |
getTraversals(ResourceMappingContext context,
org.eclipse.core.runtime.IProgressMonitor monitor)
Returns one or more traversals that can be used to access all the physical resources that constitute the logical resource. |
int |
hashCode()
Override hashCode to use the model object. |
Methods inherited from class org.eclipse.core.runtime.PlatformObject |
---|
getAdapter |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceMapping()
Method Detail |
---|
public void accept(ResourceMappingContext context, IResourceVisitor visitor, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IResourceVisitor.visit(org.eclipse.core.resources.IResource)
method is called for each
accessible resource in this mapping.
context
- the traversal contextvisitor
- the visitormonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
public boolean contains(ResourceMapping mapping)
This method always returns false
when the given resource
mapping's model provider id does not match that the of the receiver.
mapping
- the given resource mapping
true
if this mapping contains all the resources
of the given mapping, and false
otherwise.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare
true
if the receiver is equal to the
given object, and false
otherwise.public IMarker[] findMarkers(java.lang.String type, boolean includeSubtypes, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
includeSubtypes
is false
, only markers
whose type exactly matches the given type are returned. Returns an empty
array if there are no matching markers.
type
- the type of marker to consider, or null
to indicate all typesincludeSubtypes
- whether or not to consider sub-types of the given typemonitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if this method fails.public abstract java.lang.Object getModelObject()
public final ModelProvider getModelProvider()
getModelProviderId()
.
public abstract java.lang.String getModelProviderId()
public abstract IProject[] getProjects()
public abstract ResourceTraversal[] getTraversals(ResourceMappingContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Subclasses should, when possible, include all resources that are or may be members of the model element. For instance, a model element should return the same list of resources regardless of the existence of the files on the file system. For example, if a logical resource called "form" maps to "/p1/form.xml" and "/p1/form.java" then whether form.xml or form.java existed, they should be returned by this method.
In some cases, it may not be possible for a model element to know all the resources that may constitute the element without accessing the state of the model element in another location (e.g. a repository). This method is provided with a context which, when provided, gives access to the members of corresponding remote containers and the contents of corresponding remote files. This gives the model element the opportunity to deduce what additional resources should be included in the traversal.
context
- gives access to the state of
remote resources that correspond to local resources for the
purpose of determining traversals that adequately cover the
model element resources given the state of the model element
in another location. This parameter may be null
, in
which case the implementor can assume that only the local
resources are of interest to the client.monitor
- a progress monitor, or null
if progress
reporting is not desired
org.eclipse.core.runtime.CoreException
- if the traversals could not be obtained.public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |