Composite Refactoring
v1.0

compositeRefactoring.codemanipulation
Class CreateClass

java.lang.Object
  |
  +--org.eclipse.jdt.internal.core.JavaModelOperation
        |
        +--org.eclipse.jdt.internal.core.CreateElementInCUOperation
              |
              +--org.eclipse.jdt.internal.core.CreateTypeMemberOperation
                    |
                    +--org.eclipse.jdt.internal.core.CreateTypeOperation
                          |
                          +--compositeRefactoring.codemanipulation.CreateClass
All Implemented Interfaces:
IProgressMonitor, IWorkspaceRunnable

public class CreateClass
extends CreateTypeOperation

This is a convenience class to make the CreateTypeOperation public. The class creates a class and a compilation unit. It can also be used to create a new type within an existing type.


Fields inherited from class org.eclipse.jdt.internal.core.CreateTypeMemberOperation
fAlteredName, fDOMNode, fSource
 
Fields inherited from class org.eclipse.jdt.internal.core.CreateElementInCUOperation
fAnchorElement, fCreatedElement, fCreationOccurred, fCUDOM, fInsertionPolicy, fInsertionPosition, fReplacementLength, INSERT_AFTER, INSERT_BEFORE, INSERT_LAST
 
Fields inherited from class org.eclipse.jdt.internal.core.JavaModelOperation
fDeltas, fElementsToProcess, fForce, fgEmptyResult, fMonitor, fNested, fParentElements, fResultElements, hasModifiedResource
 
Fields inherited from interface org.eclipse.core.runtime.IProgressMonitor
UNKNOWN
 
Constructor Summary
CreateClass(IJavaElement parentElement, String source, boolean force)
          creates an object of CreateClass.
 
Method Summary
 void executeOperation()
          creates the class
 IJavaModelStatus verify()
          verifies whether a class can be created.
 IJavaModelStatus verifyNameCollision()
          verifies a name collision.
 
Methods inherited from class org.eclipse.jdt.internal.core.CreateTypeOperation
generateElementDOM, generateResultHandle, getMainTaskName, getType
 
Methods inherited from class org.eclipse.jdt.internal.core.CreateTypeMemberOperation
generateNewCompilationUnitDOM, generateSyntaxIncorrectDOM, setAlteredName
 
Methods inherited from class org.eclipse.jdt.internal.core.CreateElementInCUOperation
checkCanceled, createAfter, createBefore, generateResultHandles, getCompilationUnit, getMainAmountOfWork, getResultElements, initializeDefaultPosition, insertDOMNode, setRelativePosition
 
Methods inherited from class org.eclipse.jdt.internal.core.JavaModelOperation
addDelta, beginTask, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, execute, executeNestedOperation, getCompilationUnitFor, getElementsToProcess, getElementToProcess, getJavaModel, getParentElement, getParentElements, getSubProgressMonitor, getWorkspace, hasModifiedResource, internalWorked, isCanceled, isReadOnly, makeWorkingCopiesConsistent, moveResources, newJavaElementDelta, registerDeltas, run, setCanceled, setNested, setTaskName, subTask, walkDeltaMakingWorkingCopiesConsistent, worked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateClass

public CreateClass(IJavaElement parentElement,
                   String source,
                   boolean force)
creates an object of CreateClass.
Parameters:
parentElement - the parent element of the new created class. This can be either a compilation unit or a package or a type. (only compilation unit is tested!)
source - the source code for the new class (it must include the whole source code of the class, not only the body)
force - indicates if an existing class with the same name should be overridden
Method Detail

verifyNameCollision

public IJavaModelStatus verifyNameCollision()
verifies a name collision. Indicates if there is another element in this parent with the same name.
Overrides:
verifyNameCollision in class CreateTypeOperation
Returns:
the status of this verification

verify

public IJavaModelStatus verify()
verifies whether a class can be created. Possible failures:
Overrides:
verify in class CreateTypeMemberOperation
Returns:
the status of this verification

executeOperation

public void executeOperation()
creates the class
Overrides:
executeOperation in class CreateElementInCUOperation
Following copied from class: org.eclipse.jdt.internal.core.CreateElementInCUOperation
Throws:
JavaModelException - if the operation is unable to complete

Composite Refactoring
v1.0