package org.eclipse.jdt.core; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import org.eclipse.core.resources.IResourceDelta; /** * A Java element delta describes changes in Java element between two discrete * points in time. Given a delta, clients can access the element that has * changed, and any children that have changed. *
* Deltas have a different status depending on the kind of change they represent.
* The list below summarizes each status (as returned by getKind
)
* and its meaning:
*
ADDED
- The element described by the delta
* has been added. Additional information is specified by
* getFlags
which returns F_ADDED_TO_CLASSPATH
* if the element added is a package fragment root on the classpath.REMOVED
- The element described by the delta
* has been removed. Additional information is specified by
* getFlags
which returns F_REMOVED_FROM_CLASSPATH
* if the element removed was a package fragment root on the classpath.CHANGED
- The element described by the delta
* has been changed in some way. Specification of the type of change is provided
* by getFlags
which returns the following values:
* F_CONTENT
- The contents of the element have been altered. This flag
* is only valid for elements which correspond to files.F_CHILDREN
- A child of the element has changed in some way. This flag
* is only valid if the element is an IParent
.F_MODIFIERS
- the modifiers on the element have changed in some way.
* This flag is only valid if the element is an IMember
.F_OPENED
- the underlying IProject
* has been opened. This flag is only valid if the element is an IJavaModel
* or an IJavaProject
.F_CLOSED
- the underlying IProject
* has been closed. This flag is only valid if the element is an IJavaModel
* or an IJavaProject
.
* Move operations are indicated by other change flags, layered on top
* of the change flags described above. If element A is moved to become B,
* the delta for the change in A will have status REMOVED
,
* with change flag F_MOVED_TO
. In this case,
* getMovedToElement
on delta A will return the handle for B.
* The delta for B will have status ADDED
, with change flag
* F_MOVED_FROM
, and getMovedFromElement
on delta
* B will return the handle for A. (Note, the handle to A in this case represents
* an element that no longer exists).
*
* Note that the move change flags only describe the changes to a single element, they * do not imply anything about the parent or children of the element. *
*
* The following flags describe changes in an IJavaProject
's classpath:
*
F_ADDED_TO_CLASSPATH
- the element described by the delta has been added to the
* classpath.F_REMOVED_FROM_CLASSPATH
- the element described by the delta has been removed
* from the classpath.F_CLASSPATH_REORDER
- the element described by the delta has changed its
* position in the classpath.
* IJavaElementDelta
object are not valid outside the dynamic scope
* of the notification.
*
* This interface is not intended to be implemented by clients. *
*/ public interface IJavaElementDelta { /** * Status constant indicating that the element has been added. */ public int ADDED = 1; /** * Status constant indicating that the element has been removed. */ public int REMOVED = 2; /** * Status constant indicating that the element has been changed, * as described by the change flags. */ public int CHANGED = 4; /** * Change flag indicating that the content of the element has changed. */ public int F_CONTENT = 0x0001; /** * Change flag indicating that the modifiers of the element have changed. */ public int F_MODIFIERS = 0x0002; /** * Change flag indicating that there are changes to the children of the element. */ public int F_CHILDREN = 0x0008; /** * Change flag indicating that the element was moved from another location. * The location of the old element can be retrieved usinggetMovedFromElement
.
*/
public int F_MOVED_FROM = 0x0010;
/**
* Change flag indicating that the element was moved to another location.
* The location of the new element can be retrieved using getMovedToElement
.
*/
public int F_MOVED_TO = 0x0020;
/**
* Change flag indicating that the element was added to the classpath. In this
* case the element is an IPackageFragmentRoot
.
*/
public int F_ADDED_TO_CLASSPATH = 0x0040;
/**
* Change flag indicating that the element was removed from the classpath. In this
* case the element is an IPackageFragmentRoot
.
*/
public int F_REMOVED_FROM_CLASSPATH = 0x0080;
/**
* Change flag indicating that the element's position in the classpath has changed.
* In this case the element is an IPackageFragmentRoot
.
*/
public int F_CLASSPATH_REORDER = 0x0100;
/**
* Change flag indicating that the underlying IProject
has been
* opened.
*/
public int F_OPENED = 0x0200;
/**
* Change flag indicating that the underlying IProject
has been
* closed.
*/
public int F_CLOSED = 0x0400;
/**
* Change flag indicating that one of the supertypes of an IType
* has changed.
*/
public int F_SUPER_TYPES = 0x0800;
/**
* Change flag indicating that a source jar has been attached to a binary jar.
*/
public int F_SOURCEATTACHED = 0x1000;
/**
* Change flag indicating that a source jar has been detached to a binary jar.
*/
public int F_SOURCEDETACHED = 0x2000;
/**
* Returns deltas for the children that have been added.
*/
public IJavaElementDelta[] getAddedChildren();
/**
* Returns deltas for the affected (added, removed, or changed) children.
*/
public IJavaElementDelta[] getAffectedChildren();
/**
* Returns deltas for the children which have changed.
*/
public IJavaElementDelta[] getChangedChildren();
/**
* Returns the element that this delta describes a change to.
*/
public IJavaElement getElement();
/**
* Returns flags that describe how an element has changed.
*
* @see IJavaElementDelta#F_CHILDREN
* @see IJavaElementDelta#F_CONTENT
* @see IJavaElementDelta#F_MODIFIERS
* @see IJavaElementDelta#F_MOVED_FROM
* @see IJavaElementDelta#F_MOVED_TO
* @see IJavaElementDelta#F_ADDED_TO_CLASSPATH
* @see IJavaElementDelta#F_REMOVED_FROM_CLASSPATH
* @see IJavaElementDelta#F_CLASSPATH_REORDER
*/
public int getFlags();
/**
* Returns the kind of this delta - one of ADDED
, REMOVED
,
* or CHANGED
.
*/
public int getKind();
/**
* Returns an element describing this element before it was moved
* to its current location, or null
if the
* F_MOVED_FROM
change flag is not set.
*/
public IJavaElement getMovedFromElement();
/**
* Returns an element describing this element in its new location,
* or null
if the F_MOVED_TO
change
* flag is not set.
*/
public IJavaElement getMovedToElement();
/**
* Returns deltas for the children which have been removed.
*/
public IJavaElementDelta[] getRemovedChildren();
/**
* Returns the collection of resource deltas.
* * Note that resource deltas, like Java element deltas, are generally only valid * for the dynamic scope of an event notification. Clients must not hang on to * these objects. *
* * @return the underlying resource deltas, ornull
if none
*/
public IResourceDelta[] getResourceDeltas();
}