org.eclipse.jdt.internal.core
Class CreateCompilationUnitOperation

java.lang.Object
  extended by org.eclipse.jdt.internal.core.JavaModelOperation
      extended by org.eclipse.jdt.internal.core.CreateCompilationUnitOperation
All Implemented Interfaces:
IWorkspaceRunnable, org.eclipse.core.runtime.IProgressMonitor

public class CreateCompilationUnitOperation
extends JavaModelOperation

This operation creates a compilation unit (CU). If the CU doesn't exist yet, a new compilation unit will be created with the content provided. Otherwise the operation will override the contents of an existing CU with the new content.

Note: It is possible to create a CU automatically when creating a class or interface. Thus, the preferred method of creating a CU is to perform a create type operation rather than first creating a CU and secondly creating a type inside the CU.

Required Attributes:


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
CreateCompilationUnitOperation(IPackageFragment parentElement, java.lang.String name, java.lang.String source, boolean force)
          When executed, this operation will create a compilation unit with the given name.
 
Method Summary
 IJavaModelStatus verify()
          Possible failures: NO_ELEMENTS_TO_PROCESS - the package fragment 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

CreateCompilationUnitOperation

public CreateCompilationUnitOperation(IPackageFragment parentElement,
                                      java.lang.String name,
                                      java.lang.String source,
                                      boolean force)
When executed, this operation will create a compilation unit with the given name. The name should have the ".java" suffix.

Method Detail

verify

public IJavaModelStatus verify()
Possible failures:

See Also:
IJavaModelStatus