org.aspectj.org.eclipse.jdt.internal.core
Class CopyResourceElementsOperation

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
      extended by org.aspectj.org.eclipse.jdt.internal.core.MultiOperation
          extended by org.aspectj.org.eclipse.jdt.internal.core.CopyResourceElementsOperation
All Implemented Interfaces:
SuffixConstants
Direct Known Subclasses:
MoveResourceElementsOperation

public class CopyResourceElementsOperation
extends MultiOperation
implements SuffixConstants

This operation copies/moves/renames a collection of resources from their current container to a new container, optionally renaming the elements.

Notes:


Nested Class Summary
 
Nested classes/interfaces inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
JavaModelOperation.IPostAction
 
Field Summary
protected  java.util.ArrayList createdElements
          The list of new resources created during this operation.
protected  java.util.Map deltasPerProject
          Table specifying deltas for elements being copied/moved/renamed.
protected  ASTParser parser
          The ASTParser used to manipulate the source code of ICompilationUnit.
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.MultiOperation
insertBeforeElements, newParents, renamings, renamingsList
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
actions, actionsEnd, actionsStart, APPEND, attributes, elementsToProcess, force, HAS_MODIFIED_RESOURCE_ATTR, isNested, KEEP_EXISTING, NO_ELEMENTS, OPERATION_STACKS, parentElements, POST_ACTION_VERBOSE, progressMonitor, REMOVEALL_APPEND, resultElements, TRUE
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.compiler.util.SuffixConstants
EXTENSION_aj, EXTENSION_AJ, EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, SUFFIX_aj, SUFFIX_AJ, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_aj, SUFFIX_STRING_AJ, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA
 
Constructor Summary
CopyResourceElementsOperation(IJavaElement[] resourcesToCopy, IJavaElement[] destContainers, boolean force)
          When executed, this operation will copy the given resources to the given containers.
 
Method Summary
protected  java.lang.String getMainTaskName()
          Returns the name to be used by the progress monitor.
protected  ISchedulingRule getSchedulingRule()
           
protected  void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove)
          Sets the deltas to register the changes resulting from this operation for this source element and its destination.
protected  void processDeltas()
          Process all of the changed deltas generated by this operation.
protected  void processElement(IJavaElement element)
          Subclasses must implement this method to process a given IJavaElement.
protected  void processElements()
          Processes all the IJavaElements in turn, collecting errors and updating the progress monitor.
protected  IJavaModelStatus verify()
          Possible failures: NO_ELEMENTS_TO_PROCESS - no elements supplied to the operation INDEX_OUT_OF_BOUNDS - the number of renamings supplied to the operation does not match the number of elements that were supplied.
protected  void verify(IJavaElement element)
          This method is called for each IJavaElement before processElement.
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.MultiOperation
error, executeOperation, getDestinationParent, getNewNameFor, isMove, isRename, setInsertBefore, setRenamings, verifyDestination, verifyRenaming, verifySibling
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
addAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, checkCanceled, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, equalsOneOf, executeNestedOperation, firstActionWithID, getAttribute, getCompilationUnitFor, getCurrentOperationStack, getDocument, getElementToProcess, getJavaModel, getNestedFolders, getParentElement, getParentElements, getResultElements, getSubProgressMonitor, hasModifiedResource, internalWorked, isCanceled, isReadOnly, isTopLevelOperation, moveResources, newJavaElementDelta, popOperation, postAction, prefixesOneOf, pushOperation, removeAllPostAction, removeReconcileDelta, run, runOperation, runPostActions, setAttribute, setCanceled, setNested, setTaskName, subTask, worked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

createdElements

protected java.util.ArrayList createdElements
The list of new resources created during this operation.


deltasPerProject

protected java.util.Map deltasPerProject
Table specifying deltas for elements being copied/moved/renamed. Keyed by elements' project(s), and values are the corresponding deltas.


parser

protected ASTParser parser
The ASTParser used to manipulate the source code of ICompilationUnit.

Constructor Detail

CopyResourceElementsOperation

public CopyResourceElementsOperation(IJavaElement[] resourcesToCopy,
                                     IJavaElement[] destContainers,
                                     boolean force)
When executed, this operation will copy the given resources to the given containers. The resources and destination containers must be in the correct order. If there is > 1 destination, the number of destinations must be the same as the number of resources being copied/moved.

Method Detail

getMainTaskName

protected java.lang.String getMainTaskName()
Description copied from class: MultiOperation
Returns the name to be used by the progress monitor.

Specified by:
getMainTaskName in class MultiOperation
See Also:
MultiOperation

getSchedulingRule

protected ISchedulingRule getSchedulingRule()
Overrides:
getSchedulingRule in class JavaModelOperation

prepareDeltas

protected void prepareDeltas(IJavaElement sourceElement,
                             IJavaElement destinationElement,
                             boolean isMove)
Sets the deltas to register the changes resulting from this operation for this source element and its destination. If the operation is a cross project operation If the operation is rooted in a single project, the delta is rooted in that project


processDeltas

protected void processDeltas()
Process all of the changed deltas generated by this operation.


processElement

protected void processElement(IJavaElement element)
                       throws JavaModelException
Description copied from class: MultiOperation
Subclasses must implement this method to process a given IJavaElement.

Specified by:
processElement in class MultiOperation
Throws:
JavaModelException
See Also:
This method delegates to processCompilationUnitResource or processPackageFragmentResource, depending on the type of element.

processElements

protected void processElements()
                        throws JavaModelException
Description copied from class: MultiOperation
Processes all the IJavaElements in turn, collecting errors and updating the progress monitor.

Overrides:
processElements in class MultiOperation
Throws:
JavaModelException - if one or several operation(s) was unable to be completed.
See Also:
Overridden to allow special processing of JavaElementDeltas and fResultElements.

verify

protected IJavaModelStatus verify()
Possible failures:

Overrides:
verify in class JavaModelOperation
See Also:
IJavaModelStatus

verify

protected void verify(IJavaElement element)
               throws JavaModelException
Description copied from class: MultiOperation
This method is called for each IJavaElement before processElement. It should check that this element can be processed.

Specified by:
verify in class MultiOperation
Throws:
JavaModelException
See Also:
MultiOperation