|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
public abstract class JavaModelOperation
Defines behavior common to all Java Model operations
| Nested Class Summary | |
|---|---|
protected static interface |
JavaModelOperation.IPostAction
|
| Field Summary | |
|---|---|
protected JavaModelOperation.IPostAction[] |
actions
|
protected int |
actionsEnd
|
protected int |
actionsStart
|
protected static int |
APPEND
|
protected java.util.HashMap |
attributes
|
protected IJavaElement[] |
elementsToProcess
The elements this operation operates on, or null if this operation
does not operate on specific elements. |
protected boolean |
force
Conflict resolution policy - by default do not force (fail on a conflict). |
static java.lang.String |
HAS_MODIFIED_RESOURCE_ATTR
|
protected boolean |
isNested
A flag indicating whether this operation is nested. |
protected static int |
KEEP_EXISTING
|
protected static IJavaElement[] |
NO_ELEMENTS
An empty collection of IJavaElements - the common
empty result if no elements are created, or if this
operation is not actually executed. |
protected static java.lang.ThreadLocal |
OPERATION_STACKS
|
protected IJavaElement[] |
parentElements
The parent elements this operation operates with or null if this operation
does not operate with specific parent elements. |
protected static boolean |
POST_ACTION_VERBOSE
|
IProgressMonitor |
progressMonitor
The progress monitor passed into this operation |
protected static int |
REMOVEALL_APPEND
|
protected IJavaElement[] |
resultElements
The elements created by this operation - empty until the operation actually creates elements. |
static java.lang.String |
TRUE
|
| Constructor Summary | |
|---|---|
protected |
JavaModelOperation()
|
protected |
JavaModelOperation(IJavaElement element)
Common constructor for all Java Model operations. |
protected |
JavaModelOperation(IJavaElement[] elements)
A common constructor for all Java Model operations. |
protected |
JavaModelOperation(IJavaElement[] elements,
boolean force)
A common constructor for all Java Model operations. |
protected |
JavaModelOperation(IJavaElement[] elementsToProcess,
IJavaElement[] parentElements)
Common constructor for all Java Model operations. |
protected |
JavaModelOperation(IJavaElement[] elementsToProcess,
IJavaElement[] parentElements,
boolean force)
A common constructor for all Java Model operations. |
| Method Summary | |
|---|---|
protected void |
addAction(JavaModelOperation.IPostAction action)
|
protected void |
addDelta(IJavaElementDelta delta)
|
protected void |
addReconcileDelta(ICompilationUnit workingCopy,
IJavaElementDelta delta)
|
protected void |
applyTextEdit(ICompilationUnit cu,
TextEdit edits)
|
void |
beginTask(java.lang.String name,
int totalWork)
|
protected boolean |
canModifyRoots()
|
protected void |
checkCanceled()
Checks with the progress monitor to see whether this operation should be canceled. |
protected IJavaModelStatus |
commonVerify()
Common code used to verify the elements this operation is processing. |
protected void |
copyResources(IResource[] resources,
IPath container)
Convenience method to copy resources |
protected void |
createFile(IContainer folder,
java.lang.String name,
java.io.InputStream contents,
boolean forceFlag)
Convenience method to create a file |
protected void |
createFolder(IContainer parentFolder,
java.lang.String name,
boolean forceFlag)
Convenience method to create a folder |
protected void |
deleteEmptyPackageFragment(IPackageFragment fragment,
boolean forceFlag,
IResource rootResource)
Convenience method to delete an empty package fragment |
protected void |
deleteResource(IResource resource,
int flags)
Convenience method to delete a resource |
protected void |
deleteResources(IResource[] resources,
boolean forceFlag)
Convenience method to delete resources |
void |
done()
|
protected boolean |
equalsOneOf(IPath path,
IPath[] otherPaths)
|
void |
executeNestedOperation(JavaModelOperation operation,
int subWorkAmount)
Convenience method to run an operation within this operation |
protected abstract void |
executeOperation()
Performs the operation specific behavior. |
protected int |
firstActionWithID(java.lang.String id,
int start)
|
protected static java.lang.Object |
getAttribute(java.lang.Object key)
|
protected ICompilationUnit |
getCompilationUnitFor(IJavaElement element)
Returns the compilation unit the given element is contained in, or the element itself (if it is a compilation unit), otherwise null. |
protected static java.util.ArrayList |
getCurrentOperationStack()
|
protected IDocument |
getDocument(ICompilationUnit cu)
|
protected IJavaElement |
getElementToProcess()
Returns the element to which this operation applies, or null if not applicable. |
IJavaModel |
getJavaModel()
Returns the Java Model this operation is operating in. |
protected IPath[] |
getNestedFolders(IPackageFragmentRoot root)
|
protected IJavaElement |
getParentElement()
Returns the parent element to which this operation applies, or null if not applicable. |
protected IJavaElement[] |
getParentElements()
Returns the parent elements to which this operation applies, or null if not applicable. |
IJavaElement[] |
getResultElements()
Returns the elements created by this operation. |
protected ISchedulingRule |
getSchedulingRule()
|
protected IProgressMonitor |
getSubProgressMonitor(int workAmount)
Creates and returns a subprogress monitor if appropriate. |
boolean |
hasModifiedResource()
Returns whether this operation has performed any resource modifications. |
void |
internalWorked(double work)
|
boolean |
isCanceled()
|
boolean |
isReadOnly()
Returns true if this operation performs no resource modifications,
otherwise false. |
protected boolean |
isTopLevelOperation()
|
protected void |
moveResources(IResource[] resources,
IPath container)
Convenience method to move resources |
JavaElementDelta |
newJavaElementDelta()
Creates and returns a new IJavaElementDelta
on the Java Model. |
protected JavaModelOperation |
popOperation()
|
protected void |
postAction(JavaModelOperation.IPostAction action,
int insertionMode)
|
protected boolean |
prefixesOneOf(IPath path,
IPath[] otherPaths)
|
protected void |
pushOperation(JavaModelOperation operation)
|
protected void |
removeAllPostAction(java.lang.String actionID)
|
protected void |
removeReconcileDelta(ICompilationUnit workingCopy)
|
void |
run(IProgressMonitor monitor)
Runs this operation and registers any deltas created. |
void |
runOperation(IProgressMonitor monitor)
Main entry point for Java Model operations. |
protected void |
runPostActions()
|
protected static void |
setAttribute(java.lang.Object key,
java.lang.Object attribute)
|
void |
setCanceled(boolean b)
|
protected void |
setNested(boolean nested)
Sets whether this operation is nested or not. |
void |
setTaskName(java.lang.String name)
|
void |
subTask(java.lang.String name)
|
protected IJavaModelStatus |
verify()
Returns a status indicating if there is any known reason this operation will fail. |
void |
worked(int work)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int APPEND
protected static final int REMOVEALL_APPEND
protected static final int KEEP_EXISTING
protected static boolean POST_ACTION_VERBOSE
protected JavaModelOperation.IPostAction[] actions
protected int actionsStart
protected int actionsEnd
protected java.util.HashMap attributes
public static final java.lang.String HAS_MODIFIED_RESOURCE_ATTR
public static final java.lang.String TRUE
protected IJavaElement[] elementsToProcess
null if this operation
does not operate on specific elements.
protected IJavaElement[] parentElements
null if this operation
does not operate with specific parent elements.
protected static final IJavaElement[] NO_ELEMENTS
IJavaElements - the common
empty result if no elements are created, or if this
operation is not actually executed.
protected IJavaElement[] resultElements
public IProgressMonitor progressMonitor
protected boolean isNested
protected boolean force
protected static final java.lang.ThreadLocal OPERATION_STACKS
| Constructor Detail |
|---|
protected JavaModelOperation()
protected JavaModelOperation(IJavaElement[] elements)
protected JavaModelOperation(IJavaElement[] elementsToProcess,
IJavaElement[] parentElements)
protected JavaModelOperation(IJavaElement[] elementsToProcess,
IJavaElement[] parentElements,
boolean force)
protected JavaModelOperation(IJavaElement[] elements,
boolean force)
protected JavaModelOperation(IJavaElement element)
| Method Detail |
|---|
protected void addAction(JavaModelOperation.IPostAction action)
protected void addDelta(IJavaElementDelta delta)
protected void addReconcileDelta(ICompilationUnit workingCopy,
IJavaElementDelta delta)
protected void removeReconcileDelta(ICompilationUnit workingCopy)
protected void applyTextEdit(ICompilationUnit cu,
TextEdit edits)
throws JavaModelException
JavaModelException
public void beginTask(java.lang.String name,
int totalWork)
IProgressMonitorprotected boolean canModifyRoots()
protected void checkCanceled()
OperationCanceledException - if cancelling the operation has been requestedIProgressMonitor#isCanceledprotected IJavaModelStatus commonVerify()
verify()
protected void copyResources(IResource[] resources,
IPath container)
throws JavaModelException
JavaModelException
protected void createFile(IContainer folder,
java.lang.String name,
java.io.InputStream contents,
boolean forceFlag)
throws JavaModelException
JavaModelException
protected void createFolder(IContainer parentFolder,
java.lang.String name,
boolean forceFlag)
throws JavaModelException
JavaModelException
protected void deleteEmptyPackageFragment(IPackageFragment fragment,
boolean forceFlag,
IResource rootResource)
throws JavaModelException
JavaModelException
protected void deleteResource(IResource resource,
int flags)
throws JavaModelException
JavaModelException
protected void deleteResources(IResource[] resources,
boolean forceFlag)
throws JavaModelException
JavaModelExceptionpublic void done()
IProgressMonitor
protected boolean equalsOneOf(IPath path,
IPath[] otherPaths)
public void executeNestedOperation(JavaModelOperation operation,
int subWorkAmount)
throws JavaModelException
JavaModelException
protected abstract void executeOperation()
throws JavaModelException
JavaModelExceptionprotected static java.lang.Object getAttribute(java.lang.Object key)
protected ICompilationUnit getCompilationUnitFor(IJavaElement element)
null.
protected static java.util.ArrayList getCurrentOperationStack()
protected IDocument getDocument(ICompilationUnit cu)
throws JavaModelException
JavaModelExceptionprotected IJavaElement getElementToProcess()
null if not applicable.
public IJavaModel getJavaModel()
protected IPath[] getNestedFolders(IPackageFragmentRoot root)
throws JavaModelException
JavaModelExceptionprotected IJavaElement getParentElement()
null if not applicable.
protected IJavaElement[] getParentElements()
null if not applicable.
public IJavaElement[] getResultElements()
protected ISchedulingRule getSchedulingRule()
protected IProgressMonitor getSubProgressMonitor(int workAmount)
public boolean hasModifiedResource()
public void internalWorked(double work)
public boolean isCanceled()
IProgressMonitorpublic boolean isReadOnly()
true if this operation performs no resource modifications,
otherwise false. Subclasses must override.
protected boolean isTopLevelOperation()
protected int firstActionWithID(java.lang.String id,
int start)
protected void moveResources(IResource[] resources,
IPath container)
throws JavaModelException
JavaModelExceptionpublic JavaElementDelta newJavaElementDelta()
IJavaElementDelta
on the Java Model.
protected JavaModelOperation popOperation()
protected void postAction(JavaModelOperation.IPostAction action,
int insertionMode)
protected boolean prefixesOneOf(IPath path,
IPath[] otherPaths)
protected void pushOperation(JavaModelOperation operation)
protected void removeAllPostAction(java.lang.String actionID)
public void run(IProgressMonitor monitor)
throws CoreException
CoreException - if the operation failsIWorkspaceRunnable
public void runOperation(IProgressMonitor monitor)
throws JavaModelException
JavaModelException
protected void runPostActions()
throws JavaModelException
JavaModelException
protected static void setAttribute(java.lang.Object key,
java.lang.Object attribute)
public void setCanceled(boolean b)
IProgressMonitorprotected void setNested(boolean nested)
CreateElementInCUOperation.checkCanceled()public void setTaskName(java.lang.String name)
IProgressMonitorpublic void subTask(java.lang.String name)
IProgressMonitorprotected IJavaModelStatus verify()
IJavaModelStatuspublic void worked(int work)
IProgressMonitor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||