org.eclipse.jdt.internal.core
Class CreateElementInCUOperation

java.lang.Object
  extended by org.eclipse.jdt.internal.core.JavaModelOperation
      extended by org.eclipse.jdt.internal.core.CreateElementInCUOperation
All Implemented Interfaces:
IWorkspaceRunnable, org.eclipse.core.runtime.IProgressMonitor
Direct Known Subclasses:
CreateImportOperation, CreatePackageDeclarationOperation, CreateTypeMemberOperation

public abstract class CreateElementInCUOperation
extends JavaModelOperation

This abstract class implements behavior common to CreateElementInCUOperations. To create a compilation unit, or an element contained in a compilation unit, the source code for the entire compilation unit is updated and saved.

The element being created can be positioned relative to an existing element in the compilation unit via the methods #createAfter and #createBefore. By default, the new element is positioned as the last child of its parent element.


Field Summary
 
Fields inherited from class org.eclipse.jdt.internal.core.JavaModelOperation
HAS_MODIFIED_RESOURCE_ATTR, progressMonitor, TRUE
 
Fields inherited from interface org.eclipse.core.runtime.IProgressMonitor
UNKNOWN
 
Constructor Summary
CreateElementInCUOperation(IJavaElement parentElement)
          Constructs an operation that creates a Java Language Element with the specified parent, contained within a compilation unit.
 
Method Summary
 void createAfter(IJavaElement sibling)
          Instructs this operation to position the new element after the given sibling, or to add the new element as the last child of its parent if null.
 void createBefore(IJavaElement sibling)
          Instructs this operation to position the new element before the given sibling, or to add the new element as the last child of its parent if null.
abstract  java.lang.String getMainTaskName()
          Returns the name of the main task of this operation for progress reporting.
 IJavaModelStatus verify()
          Possible failures: NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is null.
 
Methods inherited from class org.eclipse.jdt.internal.core.JavaModelOperation
beginTask, done, executeNestedOperation, getJavaModel, getResultElements, hasModifiedResource, internalWorked, isCanceled, isReadOnly, newJavaElementDelta, run, runOperation, setCanceled, setTaskName, subTask, worked
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateElementInCUOperation

public CreateElementInCUOperation(IJavaElement parentElement)
Constructs an operation that creates a Java Language Element with the specified parent, contained within a compilation unit.

Method Detail

createAfter

public void createAfter(IJavaElement sibling)
Instructs this operation to position the new element after the given sibling, or to add the new element as the last child of its parent if null.


createBefore

public void createBefore(IJavaElement sibling)
Instructs this operation to position the new element before the given sibling, or to add the new element as the last child of its parent if null.


getMainTaskName

public abstract java.lang.String getMainTaskName()
Returns the name of the main task of this operation for progress reporting.


verify

public IJavaModelStatus verify()
Possible failures:

See Also:
IJavaModelStatus, JavaConventions