Interface IResourceDelta
- All Superinterfaces:
IAdaptable
Resource deltas implement the IAdaptable
interface;
extensions are managed by the platform's adapter manager.
- See Also:
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Delta kind constant (bit mask) indicating that the resource has been added to its parent.static final int
Delta kind constant (bit mask) indicating that a phantom resource has been added at the location of the delta node.static final int
The bit mask which describes all possible delta kinds, including ones involving phantoms.static final int
Delta kind constant (bit mask) indicating that the resource has been changed.static final int
Change constant (bit mask) indicating that the content of the resource has changed.static final int
Change constant (bit mask) indicating that the resource was copied from another location.static final int
Change constant (bit mask) indicating that the content of the resource is proposed to be deleted.static final int
Change constant (bit mask) indicating that the derived flag of the resource has changed.static final int
Change constant (bit mask) indicating that a project's description has changed.static final int
Change constant (bit mask) indicating that the encoding of the resource has changed.static final int
Change constant (bit mask) indicating that the underlying file or folder of the linked resource has been added or removed.static final int
Change constant (bit mask) indicating that the resource's markers have changed.static final int
Change constant (bit mask) indicating that the resource was moved from another location.static final int
Change constant (bit mask) indicating that the resource was moved to another location.static final int
Delta kind constant indicating that the resource has not been changed in any way.static final int
Change constant (bit mask) indicating that the resource was opened or closed.static final int
Delta kind constant (bit mask) indicating that the resource has been removed from its parent.static final int
Delta kind constant (bit mask) indicating that a phantom resource has been removed from the location of the delta node.static final int
Change constant (bit mask) indicating that the resource has been replaced by another at the same location (i.e., the resource has been deleted and then added).static final int
Change constant (bit mask) indicating that the resource's sync status has changed.static final int
Change constant (bit mask) indicating that the type of the resource has changed. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(IResourceDeltaVisitor visitor) Accepts the given visitor.void
accept
(IResourceDeltaVisitor visitor, boolean includePhantoms) Accepts the given visitor.void
accept
(IResourceDeltaVisitor visitor, int memberFlags) Accepts the given visitor.findMember
(IPath path) Finds and returns the descendent delta identified by the given path in this delta, ornull
if no such descendent exists.Returns resource deltas for all children of this resource which were added, removed, or changed.getAffectedChildren
(int kindMask) Returns resource deltas for all children of this resource whose kind is included in the given mask.getAffectedChildren
(int kindMask, int memberFlags) Returns resource deltas for all children of this resource whose kind is included in the given mask.int
getFlags()
Returns flags which describe in more detail how a resource has been affected.Returns the full, absolute path of this resource delta.int
getKind()
Returns the kind of this resource delta.Returns the changes to markers on the corresponding resource.Returns the full path (in the "before" state) from which this resource (in the "after" state) was moved.Returns the full path (in the "after" state) to which this resource (in the "before" state) was moved.Returns the project-relative path of this resource delta.Returns a handle for the affected resource.Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
-
Field Details
-
NO_CHANGE
static final int NO_CHANGEDelta kind constant indicating that the resource has not been changed in any way.- See Also:
-
ADDED
static final int ADDEDDelta kind constant (bit mask) indicating that the resource has been added to its parent. That is, one that appears in the "after" state, not in the "before" one.- See Also:
-
REMOVED
static final int REMOVEDDelta kind constant (bit mask) indicating that the resource has been removed from its parent. That is, one that appears in the "before" state, not in the "after" one.- See Also:
-
CHANGED
static final int CHANGEDDelta kind constant (bit mask) indicating that the resource has been changed. That is, one that appears in both the "before" and "after" states.- See Also:
-
ADDED_PHANTOM
static final int ADDED_PHANTOMDelta kind constant (bit mask) indicating that a phantom resource has been added at the location of the delta node.- See Also:
-
REMOVED_PHANTOM
static final int REMOVED_PHANTOMDelta kind constant (bit mask) indicating that a phantom resource has been removed from the location of the delta node.- See Also:
-
ALL_WITH_PHANTOMS
static final int ALL_WITH_PHANTOMSThe bit mask which describes all possible delta kinds, including ones involving phantoms.- See Also:
-
CONTENT
static final int CONTENTChange constant (bit mask) indicating that the content of the resource has changed.- See Also:
-
MOVED_FROM
static final int MOVED_FROMChange constant (bit mask) indicating that the resource was moved from another location. The location in the "before" state can be retrieved usinggetMovedFromPath()
.- See Also:
-
MOVED_TO
static final int MOVED_TOChange constant (bit mask) indicating that the resource was moved to another location. The location in the new state can be retrieved usinggetMovedToPath()
.- See Also:
-
COPIED_FROM
static final int COPIED_FROMChange constant (bit mask) indicating that the resource was copied from another location. The location in the "before" state can be retrieved usinggetMovedFromPath()
. This flag is only used when describing potential changes using anIResourceChangeDescriptionFactory
.- Since:
- 3.2
- See Also:
-
OPEN
static final int OPENChange constant (bit mask) indicating that the resource was opened or closed. This flag is also set when the project did not exist in the "before" state. For example, if the current state of the resource is open then it was previously closed or did not exist.- See Also:
-
TYPE
static final int TYPEChange constant (bit mask) indicating that the type of the resource has changed.- See Also:
-
SYNC
static final int SYNCChange constant (bit mask) indicating that the resource's sync status has changed. This type of change is not included in build deltas, only in those for resource notification.- See Also:
-
MARKERS
static final int MARKERSChange constant (bit mask) indicating that the resource's markers have changed. This type of change is not included in build deltas, only in those for resource notification.- See Also:
-
REPLACED
static final int REPLACEDChange constant (bit mask) indicating that the resource has been replaced by another at the same location (i.e., the resource has been deleted and then added).- See Also:
-
DESCRIPTION
static final int DESCRIPTIONChange constant (bit mask) indicating that a project's description has changed.- See Also:
-
ENCODING
static final int ENCODINGChange constant (bit mask) indicating that the encoding of the resource has changed.- Since:
- 3.0
- See Also:
-
LOCAL_CHANGED
static final int LOCAL_CHANGEDChange constant (bit mask) indicating that the underlying file or folder of the linked resource has been added or removed.- Since:
- 3.4
- See Also:
-
DERIVED_CHANGED
static final int DERIVED_CHANGEDChange constant (bit mask) indicating that the derived flag of the resource has changed.- Since:
- 3.6
- See Also:
-
DELETE_CONTENT_PROPOSED
static final int DELETE_CONTENT_PROPOSEDChange constant (bit mask) indicating that the content of the resource is proposed to be deleted. This flag can only be found in deltas created byIResourceChangeDescriptionFactory
and indicates that the underlined file object is proposed to be deleted from the file system (as opposite to the change where only workspace model is deleted).- Since:
- 3.16
- See Also:
-
-
Method Details
-
accept
Accepts the given visitor. The only kinds of resource deltas visited areADDED
,REMOVED
, andCHANGED
. The visitor'svisit
method is called with this resource delta if applicable. If the visitor returnstrue
, the resource delta's children are also visited.This is a convenience method, fully equivalent to
accept(visitor, IResource.NONE)
. Although the visitor will be invoked for this resource delta, it will not be invoked for any team-private member resources.- Parameters:
visitor
- the visitor- Throws:
CoreException
- if the visitor failed with this exception.- See Also:
-
accept
Accepts the given visitor. The visitor'svisit
method is called with this resource delta. If the visitor returnstrue
, the resource delta's children are also visited.This is a convenience method, fully equivalent to:
accept(visitor, includePhantoms ? INCLUDE_PHANTOMS : IResource.NONE);
Although the visitor will be invoked for this resource delta, it will not be invoked for any team-private member resources.
- Parameters:
visitor
- the visitorincludePhantoms
-true
if phantom resources are of interest;false
if phantom resources are not of interest- Throws:
CoreException
- if the visitor failed with this exception.- See Also:
-
accept
Accepts the given visitor. The visitor'svisit
method is called with this resource delta. If the visitor returnstrue
, the resource delta's children are also visited.The member flags determine which child deltas of this resource delta will be visited. The visitor will always be invoked for this resource delta.
If the
INCLUDE_PHANTOMS
member flag is not specified (recommended), only child resource deltas involving existing resources will be visited (kindsADDED
,REMOVED
, andCHANGED
). If theINCLUDE_PHANTOMS
member flag is specified, the result will also include additions and removes of phantom resources (kindsADDED_PHANTOM
andREMOVED_PHANTOM
).If the
INCLUDE_TEAM_PRIVATE_MEMBERS
member flag is not specified (recommended), resource deltas involving team private member resources will be excluded from the visit. If theINCLUDE_TEAM_PRIVATE_MEMBERS
member flag is specified, the visit will also include additions and removes of team private member resources.- Parameters:
visitor
- the visitormemberFlags
- bit-wise or of member flag constants (IContainer.INCLUDE_PHANTOMS
,INCLUDE_HIDDEN
andINCLUDE_TEAM_PRIVATE_MEMBERS
) indicating which members are of interest- Throws:
CoreException
- if the visitor failed with this exception.- Since:
- 2.0
- See Also:
-
findMember
Finds and returns the descendent delta identified by the given path in this delta, ornull
if no such descendent exists. The supplied path may be absolute or relative; in either case, it is interpreted as relative to this delta. Trailing separators are ignored. If the path is empty this delta is returned.This is a convenience method to avoid manual traversal of the delta tree in cases where the listener is only interested in changes to particular resources. Calling this method will generally be faster than manually traversing the delta to a particular descendent.
- Parameters:
path
- the path of the desired descendent delta- Returns:
- the descendent delta, or
null
if no such descendent exists in the delta - Since:
- 2.0
-
getAffectedChildren
IResourceDelta[] getAffectedChildren()Returns resource deltas for all children of this resource which were added, removed, or changed. Returns an empty array if there are no affected children.This is a convenience method, fully equivalent to:
getAffectedChildren(ADDED | REMOVED | CHANGED, IResource.NONE);
Team-private member resources are not included in the result; neither are phantom resources.
- Returns:
- the resource deltas for all affected children
- See Also:
-
getAffectedChildren
Returns resource deltas for all children of this resource whose kind is included in the given mask. Kind masks are formed by the bitwise or ofIResourceDelta
kind constants. Returns an empty array if there are no affected children.This is a convenience method, fully equivalent to:
getAffectedChildren(kindMask, IResource.NONE);
Team-private member resources are not included in the result.
- Parameters:
kindMask
- a mask formed by the bitwise or ofIResourceDelta
delta kind constants- Returns:
- the resource deltas for all affected children
- See Also:
-
getAffectedChildren
Returns resource deltas for all children of this resource whose kind is included in the given mask. Masks are formed by the bitwise or ofIResourceDelta
kind constants. Returns an empty array if there are no affected children.If the
INCLUDE_TEAM_PRIVATE_MEMBERS
member flag is not specified, (recommended), resource deltas involving team private member resources will be excluded. If theINCLUDE_TEAM_PRIVATE_MEMBERS
member flag is specified, the result will also include resource deltas of the specified kinds to team private member resources.If the
IContainer.INCLUDE_HIDDEN
member flag is not specified, (recommended), resource deltas involving hidden resources will be excluded. If theIContainer.INCLUDE_HIDDEN
member flag is specified, the result will also include resource deltas of the specified kinds to hidden resources.Specifying the
IContainer.INCLUDE_PHANTOMS
member flag is equivalent to includingIContainer.ADDED_PHANTOM
andIContainer.REMOVED_PHANTOM
in the kind mask.- Parameters:
kindMask
- a mask formed by the bitwise or ofIResourceDelta
delta kind constantsmemberFlags
- bit-wise or of member flag constants (IContainer.INCLUDE_PHANTOMS
,IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS
andIContainer.INCLUDE_HIDDEN
) indicating which members are of interest- Returns:
- the resource deltas for all affected children
- Since:
- 2.0
- See Also:
-
getFlags
int getFlags()Returns flags which describe in more detail how a resource has been affected.The following codes (bit masks) are used when kind is
CHANGED
, and also when the resource is involved in a move:CONTENT
- The bytes contained by the resource have been altered, orIResource.touch
has been called on the resource.DERIVED_CHANGED
- The derived flag of the resource has been altered.ENCODING
- The encoding of the resource may have been altered. This flag is not set when the encoding changes due to the file being modified, or being moved.DESCRIPTION
- The description of the project has been altered, orIResource.touch
has been called on the project. This flag is only valid for project resources.OPEN
- The project's open/closed state has changed. If it is not open, it was closed, and vice versa. This flag is only valid for project resources.TYPE
- The resource (a folder or file) has changed its type.SYNC
- The resource's sync status has changed.MARKERS
- The resource's markers have changed.REPLACED
- The resource (and all its properties) was deleted (either by a delete or move), and was subsequently re-created (either by a create, move, or copy).LOCAL_CHANGED
- The resource is a linked resource, and the underlying file system object has been added or removed.
REMOVED
(orCHANGED
in conjunction withREPLACED
):MOVED_TO
- The resource has moved.getMovedToPath
will return the path of where it was moved to.
ADDED
(orCHANGED
in conjunction withREPLACED
):MOVED_FROM
- The resource has moved.getMovedFromPath
will return the path of where it was moved from.
IResourceChangeDescriptionFactory
:COPIED_FROM
- Change constant (bit mask) indicating that the resource was copied from another location. The location in the "before" state can be retrieved usinggetMovedFromPath()
.
A simple move operation would result in the following delta information. If a resource is moved from A to B (with no other changes to A or B), then A will have kind
REMOVED
, with flagMOVED_TO
, andgetMovedToPath
on A will return the path for B. B will have kindADDED
, with flagMOVED_FROM
, andgetMovedFromPath
on B will return the path for A. B's other flags will describe any other changes to the resource, as compared to its previous location at A.Note that the move flags only describe the changes to a single resource; they don't necessarily imply anything about the parent or children of the resource. If the children were moved as a consequence of a subtree move operation, they will have corresponding move flags as well.
Note that it is possible for a file resource to be replaced in the workspace by a folder resource (or the other way around). The resource delta, which is actually expressed in terms of paths instead or resources, shows this as a change to either the content or children.
-
getFullPath
IPath getFullPath()Returns the full, absolute path of this resource delta.Note: the returned path never has a trailing separator.
- Returns:
- the full, absolute path of this resource delta
- See Also:
-
getKind
int getKind()Returns the kind of this resource delta. Normally, one ofADDED
,REMOVED
,CHANGED
. When phantom resources have been explicitly requested, there are two additional kinds:ADDED_PHANTOM
andREMOVED_PHANTOM
.- Returns:
- the kind of this resource delta
- See Also:
-
getMarkerDeltas
IMarkerDelta[] getMarkerDeltas()Returns the changes to markers on the corresponding resource. Returns an empty array if no markers changed.- Returns:
- the marker deltas
-
getMovedFromPath
IPath getMovedFromPath()Returns the full path (in the "before" state) from which this resource (in the "after" state) was moved. This value is only valid if theMOVED_FROM
change flag is set; otherwise,null
is returned.Note: the returned path never has a trailing separator.
- Returns:
- a path, or
null
- See Also:
-
getMovedToPath
IPath getMovedToPath()Returns the full path (in the "after" state) to which this resource (in the "before" state) was moved. This value is only valid if theMOVED_TO
change flag is set; otherwise,null
is returned.Note: the returned path never has a trailing separator.
- Returns:
- a path, or
null
- See Also:
-
getProjectRelativePath
IPath getProjectRelativePath()Returns the project-relative path of this resource delta. Returns the empty path for projects and the workspace root.A resource's project-relative path indicates the route from the project to the resource. Within a workspace, there is exactly one such path for any given resource. The returned path never has a trailing separator.
- Returns:
- the project-relative path of this resource delta
- See Also:
-
getResource
IResource getResource()Returns a handle for the affected resource.For additions (
ADDED
), this handle describes the newly-added resource; i.e., the one in the "after" state.For changes (
CHANGED
), this handle also describes the resource in the "after" state. When a file or folder resource has changed type, the former type of the handle can be inferred.For removals (
REMOVED
), this handle describes the resource in the "before" state. Even though this resource would not normally exist in the current workspace, the type of resource that was removed can be determined from the handle.For phantom additions and removals (
ADDED_PHANTOM
andREMOVED_PHANTOM
), this is the handle of the phantom resource.- Returns:
- the affected resource (handle)
-