Class JavaElementDelta

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.SimpleDelta
org.aspectj.org.eclipse.jdt.internal.core.JavaElementDelta
All Implemented Interfaces:
IJavaElementDelta

public class JavaElementDelta extends SimpleDelta implements IJavaElementDelta
See Also:
IJavaElementDelta
  • Field Details

    • ignoreFromTests

      public boolean ignoreFromTests
  • Constructor Details

    • JavaElementDelta

      public JavaElementDelta(IJavaElement element)
      Creates the root delta. To create the nested delta hierarchies use the following convenience methods. The root delta can be created at any level (for example: project, package root, package fragment...).
      • added(IJavaElement)
      • changed(IJavaElement)
      • moved(IJavaElement, IJavaElement)
      • removed(IJavaElement)
      • renamed(IJavaElement, IJavaElement)
  • Method Details

    • addAffectedChild

      protected void addAffectedChild(JavaElementDelta child)
      Adds the child delta to the collection of affected children. If the child is already in the collection, walk down the hierarchy.
    • added

      public void added(IJavaElement element)
      Creates the nested deltas resulting from an add operation. Convenience method for creating add deltas. The constructor should be used to create the root delta and then an add operation should call this method.
    • added

      public void added(IJavaElement element, int flags)
    • addNewChild

      protected void addNewChild(JavaElementDelta child)
      Adds the new child delta to the collection of affected children.
    • addResourceDelta

      protected void addResourceDelta(org.eclipse.core.resources.IResourceDelta child)
      Adds the child delta to the collection of affected children. If the child is already in the collection, walk down the hierarchy.
    • changed

      public JavaElementDelta changed(IJavaElement element, int changeFlag)
      Creates the nested deltas resulting from a change operation. Convenience method for creating change deltas. The constructor should be used to create the root delta and then a change operation should call this method.
    • changedAST

      public void changedAST(CompilationUnit changedAST)
    • clearAffectedChildren

      protected void clearAffectedChildren()
      Clears the collection of affected children.
    • contentChanged

      public void contentChanged()
      Mark this delta as a content changed delta.
    • closed

      public void closed(IJavaElement element)
      Creates the nested deltas for a closed element.
    • createDeltaTree

      protected JavaElementDelta createDeltaTree(IJavaElement element, JavaElementDelta delta)
      Creates the nested delta deltas based on the affected element its delta, and the root of this delta tree. Returns the root of the created delta tree.
    • equalsAndSameParent

      protected static boolean equalsAndSameParent(IJavaElement e1, IJavaElement e2)
      Returns whether the two java elements are equals and have the same parent.
    • find

      protected JavaElementDelta find(IJavaElement e)
      Returns the JavaElementDelta for the given element in the delta tree, or null, if no delta for the given element is found.
    • findDescendant

      protected JavaElementDelta findDescendant(JavaElementDelta.Key key)
      Returns the descendant delta for the given key, or null, if no delta for the given key is found in the delta tree below this delta.
    • fineGrained

      public void fineGrained()
      Mark this delta as a fine-grained delta.
    • getAddedChildren

      public IJavaElementDelta[] getAddedChildren()
      Description copied from interface: IJavaElementDelta
      Returns deltas for the children that have been added.
      Specified by:
      getAddedChildren in interface IJavaElementDelta
      Returns:
      deltas for the children that have been added
      See Also:
      IJavaElementDelta
    • getAffectedChildren

      public IJavaElementDelta[] getAffectedChildren()
      Description copied from interface: IJavaElementDelta
      Returns deltas for the affected (added, removed, or changed) children.
      Specified by:
      getAffectedChildren in interface IJavaElementDelta
      Returns:
      deltas for the affected (added, removed, or changed) children
      See Also:
      IJavaElementDelta
    • getCompilationUnitAST

      public CompilationUnit getCompilationUnitAST()
      Description copied from interface: IJavaElementDelta
      Returns the compilation unit AST created by the last reconcile operation on this delta's element. This returns a non-null value if and only if:
      Specified by:
      getCompilationUnitAST in interface IJavaElementDelta
      Returns:
      the AST created during the last reconcile operation
      See Also:
      ICompilationUnit.reconcile(int, boolean, WorkingCopyOwner, org.eclipse.core.runtime.IProgressMonitor), IJavaElementDelta.F_AST_AFFECTED
    • getAnnotationDeltas

      public IJavaElementDelta[] getAnnotationDeltas()
      Description copied from interface: IJavaElementDelta
      Returns deltas for affected annotations (added, removed, or changed). Returns an empty array if no annotations was affected, or if this delta's element is not an IAnnotatable.
      Specified by:
      getAnnotationDeltas in interface IJavaElementDelta
      Returns:
      deltas for affected annotations (added, removed, or changed)
    • getChangedChildren

      public IJavaElementDelta[] getChangedChildren()
      Description copied from interface: IJavaElementDelta
      Returns deltas for the children which have changed.
      Specified by:
      getChangedChildren in interface IJavaElementDelta
      Returns:
      deltas for the children which have changed
      See Also:
      IJavaElementDelta
    • getChildIndex

      protected Integer getChildIndex(JavaElementDelta.Key key)
      Returns the index of the delta in the collection of affected children, or null if the child delta for the given key is not found.
    • getChildrenOfType

      protected IJavaElementDelta[] getChildrenOfType(int type)
      See Also:
      IJavaElementDelta
    • getDeltaFor

      protected JavaElementDelta getDeltaFor(IJavaElement element)
      Returns the delta for a given element. Only looks below this delta.
    • getElement

      public IJavaElement getElement()
      Description copied from interface: IJavaElementDelta
      Returns the element that this delta describes a change to.
      Specified by:
      getElement in interface IJavaElementDelta
      Returns:
      the element that this delta describes a change to
      See Also:
      IJavaElementDelta
    • getMovedFromElement

      public IJavaElement getMovedFromElement()
      Description copied from interface: IJavaElementDelta
      Returns an element describing this element before it was moved to its current location, or null if the IJavaElementDelta.F_MOVED_FROM change flag is not set.
      Specified by:
      getMovedFromElement in interface IJavaElementDelta
      Returns:
      an element describing this element before it was moved to its current location, or null if the IJavaElementDelta.F_MOVED_FROM change flag is not set
      See Also:
      IJavaElementDelta
    • getMovedToElement

      public IJavaElement getMovedToElement()
      Description copied from interface: IJavaElementDelta
      Returns an element describing this element in its new location, or null if the IJavaElementDelta.F_MOVED_TO change flag is not set.
      Specified by:
      getMovedToElement in interface IJavaElementDelta
      Returns:
      an element describing this element in its new location, or null if the IJavaElementDelta.F_MOVED_TO change flag is not set
      See Also:
      IJavaElementDelta
    • getRemovedChildren

      public IJavaElementDelta[] getRemovedChildren()
      Description copied from interface: IJavaElementDelta
      Returns deltas for the children which have been removed.
      Specified by:
      getRemovedChildren in interface IJavaElementDelta
      Returns:
      deltas for the children which have been removed
      See Also:
      IJavaElementDelta
    • getResourceDeltas

      public org.eclipse.core.resources.IResourceDelta[] getResourceDeltas()
      Return the collection of resource deltas. Return null if none.
      Specified by:
      getResourceDeltas in interface IJavaElementDelta
      Returns:
      the underlying resource deltas, or null if none
    • growAndAddToArray

      protected IJavaElementDelta[] growAndAddToArray(IJavaElementDelta[] array, IJavaElementDelta addition)
      Adds the new element to a new array that contains all of the elements of the old array. Returns the new array.
    • insertDeltaTree

      protected void insertDeltaTree(IJavaElement element, JavaElementDelta delta)
      Creates the delta tree for the given element and delta, and then inserts the tree as an affected child of this node.
    • movedFrom

      public void movedFrom(IJavaElement movedFromElement, IJavaElement movedToElement)
      Creates the nested deltas resulting from an move operation. Convenience method for creating the "move from" delta. The constructor should be used to create the root delta and then the move operation should call this method.
    • movedTo

      public void movedTo(IJavaElement movedToElement, IJavaElement movedFromElement)
      Creates the nested deltas resulting from an move operation. Convenience method for creating the "move to" delta. The constructor should be used to create the root delta and then the move operation should call this method.
    • opened

      public void opened(IJavaElement element)
      Creates the nested deltas for an opened element.
    • removeAffectedChild

      protected void removeAffectedChild(JavaElementDelta child)
      Removes the child delta from the collection of affected children.
    • removeAndShrinkArray

      protected IJavaElementDelta[] removeAndShrinkArray(IJavaElementDelta[] old, int index)
      Removes the element from the array. Returns the a new array which has shrunk.
    • removed

      public void removed(IJavaElement element)
      Creates the nested deltas resulting from an delete operation. Convenience method for creating removed deltas. The constructor should be used to create the root delta and then the delete operation should call this method.
    • removed

      public void removed(IJavaElement element, int flags)
    • removeExistingChild

      protected void removeExistingChild(JavaElementDelta.Key key, int index)
      Removes the existing child delta from the collection of affected children.
    • sourceAttached

      public void sourceAttached(IJavaElement element)
      Creates the nested deltas resulting from a change operation. Convenience method for creating change deltas. The constructor should be used to create the root delta and then a change operation should call this method.
    • sourceDetached

      public void sourceDetached(IJavaElement element)
      Creates the nested deltas resulting from a change operation. Convenience method for creating change deltas. The constructor should be used to create the root delta and then a change operation should call this method.
    • toDebugString

      public String toDebugString(int depth)
      Returns a string representation of this delta's structure suitable for debug purposes.
      See Also:
      toString()
    • toDebugString

      protected boolean toDebugString(StringBuffer buffer, int flags)
      Overrides:
      toDebugString in class SimpleDelta
    • toString

      public String toString()
      Returns a string representation of this delta's structure suitable for debug purposes.
      Overrides:
      toString in class SimpleDelta