Klasse JavaModelOperation
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
- Alle implementierten Schnittstellen:
org.eclipse.core.resources.IWorkspaceRunnable
,org.eclipse.core.runtime.ICoreRunnable
,org.eclipse.core.runtime.IProgressMonitor
- Bekannte direkte Unterklassen:
BatchOperation
,BecomeWorkingCopyOperation
,ChangeClasspathOperation
,CommitWorkingCopyOperation
,CopyPackageFragmentRootOperation
,CreateCompilationUnitOperation
,CreateElementInCUOperation
,CreatePackageFragmentOperation
,CreateTypeHierarchyOperation
,DeletePackageFragmentRootOperation
,DiscardWorkingCopyOperation
,MultiOperation
,ReconcileWorkingCopyOperation
,SortElementsOperation
public abstract class JavaModelOperation
extends Object
implements org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.IProgressMonitor
Defines behavior common to all Java Model operations
-
Verschachtelte Klassen - Übersicht
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprotected JavaModelOperation.IPostAction[]
protected int
protected int
protected static final int
protected HashMap
protected IJavaElement[]
The elements this operation operates on, ornull
if this operation does not operate on specific elements.protected boolean
Conflict resolution policy - by default do not force (fail on a conflict).static final String
protected boolean
A flag indicating whether this operation is nested.protected static final int
protected static final IJavaElement[]
An empty collection ofIJavaElement
s - the common empty result if no elements are created, or if this operation is not actually executed.protected static final ThreadLocal
protected IJavaElement[]
The parent elements this operation operates with ornull
if this operation does not operate with specific parent elements.protected static boolean
org.eclipse.core.runtime.SubMonitor
The progress monitor passed into this operationprotected static final int
protected IJavaElement[]
The elements created by this operation - empty until the operation actually creates elements.static final String
Von Schnittstelle geerbte Felder org.eclipse.core.runtime.IProgressMonitor
UNKNOWN
-
Konstruktorübersicht
ModifiziererKonstruktorBeschreibungprotected
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. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected void
protected void
addDelta
(IJavaElementDelta delta) protected void
addReconcileDelta
(ICompilationUnit workingCopy, IJavaElementDelta delta) protected void
applyTextEdit
(ICompilationUnit cu, org.eclipse.text.edits.TextEdit edits) void
protected boolean
protected void
Checks with the progress monitor to see whether this operation should be canceled.protected IJavaModelStatus
Common code used to verify the elements this operation is processing.protected void
copyResources
(org.eclipse.core.resources.IResource[] resources, org.eclipse.core.runtime.IPath container) Convenience method to copy resourcesprotected void
createFile
(org.eclipse.core.resources.IContainer folder, String name, InputStream contents, boolean forceFlag) Convenience method to create a fileprotected void
createFolder
(org.eclipse.core.resources.IContainer parentFolder, String name, boolean forceFlag) Convenience method to create a folderprotected void
deleteEmptyPackageFragment
(IPackageFragment fragment, boolean forceFlag, org.eclipse.core.resources.IResource rootResource) Convenience method to delete an empty package fragmentprotected void
deleteResource
(org.eclipse.core.resources.IResource resource, int flags) Convenience method to delete a resourceprotected void
deleteResources
(org.eclipse.core.resources.IResource[] resources, boolean forceFlag) Convenience method to delete resourcesvoid
done()
protected boolean
equalsOneOf
(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] otherPaths) void
executeNestedOperation
(JavaModelOperation operation, int subWorkAmount) Convenience method to run an operation within this operationprotected abstract void
Performs the operation specific behavior.protected int
firstActionWithID
(String id, int start) protected static Object
getAttribute
(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), otherwisenull
.protected static ArrayList
protected org.eclipse.jface.text.IDocument
protected IJavaElement
Returns the element to which this operation applies, ornull
if not applicable.Returns the Java Model this operation is operating in.protected int
protected org.eclipse.core.runtime.IPath[]
protected IJavaElement
Returns the parent element to which this operation applies, ornull
if not applicable.protected IJavaElement[]
Returns the parent elements to which this operation applies, ornull
if not applicable.Returns the elements created by this operation.protected org.eclipse.core.runtime.jobs.ISchedulingRule
protected org.eclipse.core.runtime.IProgressMonitor
getSubProgressMonitor
(int workAmount) Creates and returns a subprogress monitor if appropriate.boolean
Returns whether this operation has performed any resource modifications.void
internalWorked
(double work) boolean
boolean
Returnstrue
if this operation performs no resource modifications, otherwisefalse
.protected boolean
protected void
moveResources
(org.eclipse.core.resources.IResource[] resources, org.eclipse.core.runtime.IPath container) Convenience method to move resourcesCreates and returns a newIJavaElementDelta
on the Java Model.protected JavaModelOperation
protected void
postAction
(JavaModelOperation.IPostAction action, int insertionMode) protected boolean
prefixesOneOf
(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] otherPaths) protected void
pushOperation
(JavaModelOperation operation) protected void
removeAllPostAction
(String actionID) protected void
removeReconcileDelta
(ICompilationUnit workingCopy) void
run
(org.eclipse.core.runtime.IProgressMonitor monitor) Runs this operation and registers any deltas created.void
runOperation
(org.eclipse.core.runtime.IProgressMonitor monitor) Main entry point for Java Model operations.protected void
protected static void
setAttribute
(Object key, Object attribute) void
setCanceled
(boolean b) protected void
setNested
(boolean nested) Sets whether this operation is nested or not.void
setTaskName
(String name) void
protected IJavaModelStatus
verify()
Returns a status indicating if there is any known reason this operation will fail.void
worked
(int work) Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Von Schnittstelle geerbte Methoden org.eclipse.core.runtime.IProgressMonitor
clearBlocked, setBlocked, slice
-
Felddetails
-
APPEND
protected static final int APPEND- Siehe auch:
-
REMOVEALL_APPEND
protected static final int REMOVEALL_APPEND- Siehe auch:
-
KEEP_EXISTING
protected static final int KEEP_EXISTING- Siehe auch:
-
POST_ACTION_VERBOSE
protected static boolean POST_ACTION_VERBOSE -
actions
-
actionsStart
protected int actionsStart -
actionsEnd
protected int actionsEnd -
attributes
-
HAS_MODIFIED_RESOURCE_ATTR
- Siehe auch:
-
TRUE
- Siehe auch:
-
elementsToProcess
The elements this operation operates on, ornull
if this operation does not operate on specific elements. -
parentElements
The parent elements this operation operates with ornull
if this operation does not operate with specific parent elements. -
NO_ELEMENTS
An empty collection ofIJavaElement
s - the common empty result if no elements are created, or if this operation is not actually executed. -
resultElements
The elements created by this operation - empty until the operation actually creates elements. -
progressMonitor
public org.eclipse.core.runtime.SubMonitor progressMonitorThe progress monitor passed into this operation -
isNested
protected boolean isNestedA flag indicating whether this operation is nested. -
force
protected boolean forceConflict resolution policy - by default do not force (fail on a conflict). -
OPERATION_STACKS
-
-
Konstruktordetails
-
JavaModelOperation
protected JavaModelOperation() -
JavaModelOperation
A common constructor for all Java Model operations. -
JavaModelOperation
Common constructor for all Java Model operations. -
JavaModelOperation
protected JavaModelOperation(IJavaElement[] elementsToProcess, IJavaElement[] parentElements, boolean force) A common constructor for all Java Model operations. -
JavaModelOperation
A common constructor for all Java Model operations. -
JavaModelOperation
Common constructor for all Java Model operations.
-
-
Methodendetails
-
getLatestASTLevel
protected int getLatestASTLevel() -
addAction
-
addDelta
-
addReconcileDelta
-
removeReconcileDelta
-
applyTextEdit
protected void applyTextEdit(ICompilationUnit cu, org.eclipse.text.edits.TextEdit edits) throws JavaModelException - Löst aus:
JavaModelException
-
beginTask
- Angegeben von:
beginTask
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-
canModifyRoots
protected boolean canModifyRoots() -
checkCanceled
protected void checkCanceled()Checks with the progress monitor to see whether this operation should be canceled. An operation should regularly call this method during its operation so that the user can cancel it.- Löst aus:
org.eclipse.core.runtime.OperationCanceledException
- if cancelling the operation has been requested- Siehe auch:
-
commonVerify
Common code used to verify the elements this operation is processing.- Siehe auch:
-
copyResources
protected void copyResources(org.eclipse.core.resources.IResource[] resources, org.eclipse.core.runtime.IPath container) throws JavaModelException Convenience method to copy resources- Löst aus:
JavaModelException
-
createFile
protected void createFile(org.eclipse.core.resources.IContainer folder, String name, InputStream contents, boolean forceFlag) throws JavaModelException Convenience method to create a file- Löst aus:
JavaModelException
-
createFolder
protected void createFolder(org.eclipse.core.resources.IContainer parentFolder, String name, boolean forceFlag) throws JavaModelException Convenience method to create a folder- Löst aus:
JavaModelException
-
deleteEmptyPackageFragment
protected void deleteEmptyPackageFragment(IPackageFragment fragment, boolean forceFlag, org.eclipse.core.resources.IResource rootResource) throws JavaModelException Convenience method to delete an empty package fragment- Löst aus:
JavaModelException
-
deleteResource
protected void deleteResource(org.eclipse.core.resources.IResource resource, int flags) throws JavaModelException Convenience method to delete a resource- Löst aus:
JavaModelException
-
deleteResources
protected void deleteResources(org.eclipse.core.resources.IResource[] resources, boolean forceFlag) throws JavaModelException Convenience method to delete resources- Löst aus:
JavaModelException
-
done
public void done()- Angegeben von:
done
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-
equalsOneOf
protected boolean equalsOneOf(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] otherPaths) -
executeNestedOperation
public void executeNestedOperation(JavaModelOperation operation, int subWorkAmount) throws JavaModelException Convenience method to run an operation within this operation- Löst aus:
JavaModelException
-
executeOperation
Performs the operation specific behavior. Subclasses must override.- Löst aus:
JavaModelException
-
getAttribute
-
getCompilationUnitFor
Returns the compilation unit the given element is contained in, or the element itself (if it is a compilation unit), otherwisenull
. -
getCurrentOperationStack
-
getDocument
protected org.eclipse.jface.text.IDocument getDocument(ICompilationUnit cu) throws JavaModelException - Löst aus:
JavaModelException
-
getElementToProcess
Returns the element to which this operation applies, ornull
if not applicable. -
getJavaModel
Returns the Java Model this operation is operating in. -
getNestedFolders
protected org.eclipse.core.runtime.IPath[] getNestedFolders(IPackageFragmentRoot root) throws JavaModelException - Löst aus:
JavaModelException
-
getParentElement
Returns the parent element to which this operation applies, ornull
if not applicable. -
getParentElements
Returns the parent elements to which this operation applies, ornull
if not applicable. -
getResultElements
Returns the elements created by this operation. -
getSchedulingRule
protected org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule() -
getSubProgressMonitor
protected org.eclipse.core.runtime.IProgressMonitor getSubProgressMonitor(int workAmount) Creates and returns a subprogress monitor if appropriate. -
hasModifiedResource
public boolean hasModifiedResource()Returns whether this operation has performed any resource modifications. Returns false if this operation has not been executed yet. -
internalWorked
public void internalWorked(double work) - Angegeben von:
internalWorked
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
-
isCanceled
public boolean isCanceled()- Angegeben von:
isCanceled
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-
isReadOnly
public boolean isReadOnly()Returnstrue
if this operation performs no resource modifications, otherwisefalse
. Subclasses must override. -
isTopLevelOperation
protected boolean isTopLevelOperation() -
firstActionWithID
-
moveResources
protected void moveResources(org.eclipse.core.resources.IResource[] resources, org.eclipse.core.runtime.IPath container) throws JavaModelException Convenience method to move resources- Löst aus:
JavaModelException
-
newJavaElementDelta
Creates and returns a newIJavaElementDelta
on the Java Model. -
popOperation
-
postAction
-
prefixesOneOf
protected boolean prefixesOneOf(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] otherPaths) -
pushOperation
-
removeAllPostAction
-
run
public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Runs this operation and registers any deltas created.- Angegeben von:
run
in Schnittstelleorg.eclipse.core.runtime.ICoreRunnable
- Angegeben von:
run
in Schnittstelleorg.eclipse.core.resources.IWorkspaceRunnable
- Löst aus:
org.eclipse.core.runtime.CoreException
- if the operation fails- Siehe auch:
-
runOperation
public void runOperation(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Main entry point for Java Model operations. Runs a Java Model Operation as an IWorkspaceRunnable if not read-only.- Löst aus:
JavaModelException
-
runPostActions
- Löst aus:
JavaModelException
-
setAttribute
-
setCanceled
public void setCanceled(boolean b) - Angegeben von:
setCanceled
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-
setNested
protected void setNested(boolean nested) Sets whether this operation is nested or not.- Siehe auch:
-
setTaskName
- Angegeben von:
setTaskName
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-
subTask
- Angegeben von:
subTask
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-
verify
Returns a status indicating if there is any known reason this operation will fail. Operations are verified before they are run. Subclasses must override if they have any conditions to verify before this operation executes.- Siehe auch:
-
worked
public void worked(int work) - Angegeben von:
worked
in Schnittstelleorg.eclipse.core.runtime.IProgressMonitor
- Siehe auch:
-