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.
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 |
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
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:
- NO_ELEMENTS_TO_PROCESS - the parent element supplied to the operation is
null
.
- INVALID_CONTENTS - The source is
null
or has serious syntax errors.
- NAME_COLLISION - A name collision occurred in the destination
- 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