Klasse CreateImportOperation
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
org.aspectj.org.eclipse.jdt.internal.core.CreateElementInCUOperation
org.aspectj.org.eclipse.jdt.internal.core.CreateImportOperation
- Alle implementierten Schnittstellen:
org.eclipse.core.resources.IWorkspaceRunnable
,org.eclipse.core.runtime.ICoreRunnable
,org.eclipse.core.runtime.IProgressMonitor
This operation adds an import declaration to an existing compilation unit.
If the compilation unit already includes the specified import declaration,
the import is not generated (it does not generate duplicates).
Note that it is valid to specify both a single-type import and an on-demand import
for the same package, for example "java.io.File"
and
"java.io.*"
, in which case both are preserved since the semantics
of this are not the same as just importing "java.io.*"
.
Importing "java.lang.*"
, or the package in which the compilation unit
is defined, are not treated as special cases. If they are specified, they are
included in the result.
Required Attributes:
- Compilation unit
- Import name - the name of the import to add to the
compilation unit. For example:
"java.io.File"
or"java.awt.*"
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
JavaModelOperation.IPostAction
-
Feldübersicht
Von Klasse geerbte Felder org.aspectj.org.eclipse.jdt.internal.core.CreateElementInCUOperation
anchorElement, creationOccurred, cuAST, INSERT_AFTER, INSERT_BEFORE, INSERT_LAST, insertionPolicy
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
KonstruktorBeschreibungCreateImportOperation
(String importName, ICompilationUnit parentElement, int flags) When executed, this operation will add an import to the given compilation unit. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected ASTNode
generateElementAST
(ASTRewrite rewriter, ICompilationUnit cu) protected IJavaElement
Creates and returns the handle for the element this operation created.protected StructuralPropertyDescriptor
getChildPropertyDescriptor
(ASTNode parent) Returns the name of the main task of this operation for progress reporting.protected void
Sets the correct position for the new import: after the last import if no imports, before the first type if no type, after the package statement and if no package statement - first thing in the CUverify()
Possible failures: NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation isnull
.Von Klasse geerbte Methoden org.aspectj.org.eclipse.jdt.internal.core.CreateElementInCUOperation
checkCanceled, createAfter, createBefore, executeOperation, generateNewCompilationUnitAST, generateResultHandles, getCompilationUnit, getMainAmountOfWork, getSchedulingRule, insertASTNode, parse, setAlteredName, setRelativePosition
Von Klasse geerbte Methoden org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
addAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, 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
-
importName
-
flags
protected int flags
-
-
Konstruktordetails
-
CreateImportOperation
When executed, this operation will add an import to the given compilation unit.
-
-
Methodendetails
-
getChildPropertyDescriptor
- Angegeben von:
getChildPropertyDescriptor
in KlasseCreateElementInCUOperation
-
generateElementAST
protected ASTNode generateElementAST(ASTRewrite rewriter, ICompilationUnit cu) throws JavaModelException - Angegeben von:
generateElementAST
in KlasseCreateElementInCUOperation
- Löst aus:
JavaModelException
-
generateResultHandle
Beschreibung aus Klasse kopiert:CreateElementInCUOperation
Creates and returns the handle for the element this operation created.- Angegeben von:
generateResultHandle
in KlasseCreateElementInCUOperation
- Siehe auch:
-
getMainTaskName
Beschreibung aus Klasse kopiert:CreateElementInCUOperation
Returns the name of the main task of this operation for progress reporting.- Angegeben von:
getMainTaskName
in KlasseCreateElementInCUOperation
- Siehe auch:
-
initializeDefaultPosition
protected void initializeDefaultPosition()Sets the correct position for the new import:- after the last import
- if no imports, before the first type
- if no type, after the package statement
- and if no package statement - first thing in the CU
- Setzt außer Kraft:
initializeDefaultPosition
in KlasseCreateElementInCUOperation
-
verify
Possible failures:- NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
null
. - INVALID_NAME - not a valid import declaration name.
- Setzt außer Kraft:
verify
in KlasseCreateElementInCUOperation
- Siehe auch:
- NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
-