Klasse CreateCompilationUnitOperation
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
org.aspectj.org.eclipse.jdt.internal.core.CreateCompilationUnitOperation
- Alle implementierten Schnittstellen:
org.eclipse.core.resources.IWorkspaceRunnable
,org.eclipse.core.runtime.ICoreRunnable
,org.eclipse.core.runtime.IProgressMonitor
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:
- The package fragment in which to create the compilation unit.
- The name of the compilation unit.
Do not include the
".java"
suffix (ex."Object"
- the".java"
will be added for the name of the compilation unit.)
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
JavaModelOperation.IPostAction
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprotected String
The name of the compilation unit being created.protected String
The source code to use when creating the element.Von Klasse geerbte Felder org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
actions, actionsEnd, actionsStart, APPEND, attributes, elementsToProcess, force, HAS_MODIFIED_RESOURCE_ATTR, isNested, KEEP_EXISTING, NO_ELEMENTS, OPERATION_STACKS, parentElements, POST_ACTION_VERBOSE, progressMonitor, REMOVEALL_APPEND, resultElements, TRUE
Von Schnittstelle geerbte Felder org.eclipse.core.runtime.IProgressMonitor
UNKNOWN
-
Konstruktorübersicht
KonstruktorBeschreibungCreateCompilationUnitOperation
(IPackageFragment parentElement, String name, String source, boolean force) When executed, this operation will create a compilation unit with the given name. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected void
Creates a compilation unit.protected ICompilationUnit
protected org.eclipse.core.runtime.jobs.ISchedulingRule
verify()
Possible failures: NO_ELEMENTS_TO_PROCESS - the package fragment supplied to the operation isnull
.Von Klasse geerbte Methoden org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
addAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, checkCanceled, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, equalsOneOf, executeNestedOperation, firstActionWithID, getAttribute, getCompilationUnitFor, getCurrentOperationStack, getDocument, getElementToProcess, getJavaModel, getLatestASTLevel, getNestedFolders, getParentElement, getParentElements, getResultElements, getSubProgressMonitor, hasModifiedResource, internalWorked, isCanceled, isReadOnly, isTopLevelOperation, moveResources, newJavaElementDelta, popOperation, postAction, prefixesOneOf, pushOperation, removeAllPostAction, removeReconcileDelta, run, runOperation, runPostActions, setAttribute, setCanceled, setNested, setTaskName, subTask, worked
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
-
name
The name of the compilation unit being created. -
source
The source code to use when creating the element.
-
-
Konstruktordetails
-
CreateCompilationUnitOperation
public CreateCompilationUnitOperation(IPackageFragment parentElement, String name, String source, boolean force) When executed, this operation will create a compilation unit with the given name. The name should have the ".java" suffix.
-
-
Methodendetails
-
executeOperation
Creates a compilation unit.- Angegeben von:
executeOperation
in KlasseJavaModelOperation
- Löst aus:
JavaModelException
- if unable to create the compilation unit.
-
getCompilationUnit
- Siehe auch:
-
getSchedulingRule
protected org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()- Setzt außer Kraft:
getSchedulingRule
in KlasseJavaModelOperation
-
verify
Possible failures:- NO_ELEMENTS_TO_PROCESS - the package fragment supplied to the operation is
null
. - INVALID_NAME - the compilation unit name provided to the operation
is
null
or has an invalid syntax - INVALID_CONTENTS - the source specified for the compiliation unit is null
- Setzt außer Kraft:
verify
in KlasseJavaModelOperation
- Siehe auch:
- NO_ELEMENTS_TO_PROCESS - the package fragment supplied to the operation is
-