org.eclipse.core.resources.mapping
Class ResourceTraversal
java.lang.Object
org.eclipse.core.resources.mapping.ResourceTraversal
-
public class ResourceTraversal
- extends
Object
A resource traversal is simply a set of resources and the depth to which
each is to be traversed. A set of traversals is used to describe the
resources that constitute a model element.
The flags of the traversal indicate which special resources should be
included or excluded from the traversal. The flags used are the same as
those passed to the
IResource.accept(IResourceVisitor, int, int)
method.
This class may be instantiated or subclassed by clients.
-
Since:
- 3.2
-
See Also:
-
IResource
Method Summary
|
void
|
accept
(
IResourceVisitor visitor)
Visits all existing resources defined by this traversal. |
boolean
|
contains
(
IResource resource)
Return whether the given resource is contained in or
covered by this traversal, regardless of whether the resource
currently exists. |
IMarker[]
|
findMarkers
(
String type,
boolean includeSubtypes)
Returns all markers of the specified type on existing resources in this traversal. |
int
|
getDepth
()
Returns the depth to which the resources should be traversed. |
int
|
getFlags
()
Return the flags for this traversal. |
IResource[]
|
getResources
()
Returns the file system resource(s) for this traversal. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
ResourceTraversal
public ResourceTraversal(
IResource[] resources,
int depth,
int flags)
- Creates a new resource traversal.
-
Parameters:
-
resources
- The resources in the traversal -
depth
- The traversal depth -
flags
- the flags for this traversal. The traversal flags match those
that are passed to the IResource#accept
method.
accept
public void accept(
IResourceVisitor visitor)
throws
CoreException
- Visits all existing resources defined by this traversal.
-
-
Parameters:
-
visitor
- a resource visitor
-
Throws:
-
CoreException
- if this method fails. Reasons include:
- The visitor failed with this exception.
contains
public boolean contains(
IResource resource)
- Return whether the given resource is contained in or
covered by this traversal, regardless of whether the resource
currently exists.
-
-
Parameters:
-
resource
- the resource to be tested
-
Returns:
-
true
if the resource is in this traversal, and
false
otherwise.
findMarkers
public
IMarker[] findMarkers(
String type,
boolean includeSubtypes)
throws
CoreException
- Returns all markers of the specified type on existing resources in this traversal.
If
includeSubtypes
is false
, only markers
whose type exactly matches the given type are returned. Returns an empty
array if there are no matching markers.
-
-
Parameters:
-
type
- the type of marker to consider, or null
to indicate all types -
includeSubtypes
- whether or not to consider sub-types of the given type
-
Returns:
- an array of markers
-
Throws:
-
CoreException
- if this method fails. -
See Also:
-
IResource.findMarkers(String, boolean, int)
getDepth
public int getDepth()
- Returns the depth to which the resources should be traversed.
-
-
Returns:
- the depth to which the physical resources are to be traversed
(one of IResource.DEPTH_ZERO, IResource.DEPTH_ONE or
IResource.DEPTH_INFINITE)
getFlags
public int getFlags()
- Return the flags for this traversal.
The flags of the traversal indicate which special resources should be
included or excluded from the traversal. The flags used are the same as
those passed to the
IResource#accept(IResourceVisitor, int, int)
method.
Clients who traverse the resources manually (i.e. without calling accept
)
should respect the flags when determining which resources are included
in the traversal.
-
-
Returns:
- the flags for this traversal
getResources
public
IResource[] getResources()
- Returns the file system resource(s) for this traversal. The returned
resources must be contained within the same project and need not exist in
the local file system. The traversal of the returned resources should be
done considering the flag returned by getDepth. If a resource returned by
a traversal is a file, it should always be visited. If a resource of a
traversal is a folder then files contained in the folder can only be
visited if the folder is IResource.DEPTH_ONE or IResource.DEPTH_INFINITE.
Child folders should only be visited if the depth is
IResource.DEPTH_INFINITE.
-
-
Returns:
- The resources in this traversal
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.