public class CreateFieldOperation extends CreateTypeMemberOperation
This operation creates a field declaration in a type.
Required Attributes:
JavaModelOperation.IPostActionalteredName, createdNode, sourceanchorElement, creationOccurred, cuAST, INSERT_AFTER, INSERT_BEFORE, INSERT_LAST, insertionPolicyactions, 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| Constructor and Description |
|---|
CreateFieldOperation(IType parentElement,
java.lang.String source,
boolean force)
When executed, this operation will create a field with the given name
in the given type with the specified source.
|
| Modifier and Type | Method and Description |
|---|---|
protected ASTNode |
generateElementAST(ASTRewrite rewriter,
ICompilationUnit cu) |
protected IJavaElement |
generateResultHandle()
Creates and returns the handle for the element this operation created.
|
java.lang.String |
getMainTaskName()
Returns the name of the main task of this operation for
progress reporting.
|
protected void |
initializeDefaultPosition()
By default the new field is positioned after the last existing field
declaration, or as the first member in the type if there are no
field declarations.
|
protected SimpleName |
rename(ASTNode node,
SimpleName newName) |
protected IJavaModelStatus |
verifyNameCollision()
Verify for a name collision in the destination container.
|
generateSyntaxIncorrectAST, getChildPropertyDescriptor, getType, setAlteredName, verifycheckCanceled, createAfter, createBefore, executeOperation, generateNewCompilationUnitAST, generateResultHandles, getCompilationUnit, getMainAmountOfWork, getSchedulingRule, insertASTNode, parse, setRelativePositionaddAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, equalsOneOf, executeNestedOperation, firstActionWithID, getAttribute, getCompilationUnitFor, getCurrentOperationStack, getDocument, getElementToProcess, getJavaModel, 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, workedpublic CreateFieldOperation(IType parentElement, java.lang.String source, boolean force)
By default the new field is positioned after the last existing field declaration, or as the first member in the type if there are no field declarations.
protected ASTNode generateElementAST(ASTRewrite rewriter, ICompilationUnit cu) throws JavaModelException
generateElementAST in class CreateTypeMemberOperationJavaModelExceptionprotected IJavaElement generateResultHandle()
CreateElementInCUOperationgenerateResultHandle in class CreateElementInCUOperationCreateElementInCUOperation.generateResultHandle()public java.lang.String getMainTaskName()
CreateElementInCUOperationgetMainTaskName in class CreateElementInCUOperationCreateElementInCUOperation.getMainTaskName()protected void initializeDefaultPosition()
initializeDefaultPosition in class CreateElementInCUOperationprotected IJavaModelStatus verifyNameCollision()
CreateTypeMemberOperationverifyNameCollision in class CreateTypeMemberOperationCreateTypeMemberOperation.verifyNameCollision()protected SimpleName rename(ASTNode node, SimpleName newName)
rename in class CreateTypeMemberOperation