org.aspectj.org.eclipse.jdt.internal.core
Class CreateInitializerOperation

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
      extended by org.aspectj.org.eclipse.jdt.internal.core.CreateElementInCUOperation
          extended by org.aspectj.org.eclipse.jdt.internal.core.CreateTypeMemberOperation
              extended by org.aspectj.org.eclipse.jdt.internal.core.CreateInitializerOperation

public class CreateInitializerOperation
extends CreateTypeMemberOperation

This operation creates a initializer in a type.

Required Attributes:


Nested Class Summary
 
Nested classes/interfaces inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
JavaModelOperation.IPostAction
 
Field Summary
protected  int numberOfInitializers
          The current number of initializers in the parent type.
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.CreateTypeMemberOperation
alteredName, createdNode, source
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.CreateElementInCUOperation
anchorElement, creationOccurred, cuAST, INSERT_AFTER, INSERT_BEFORE, INSERT_LAST, insertionPolicy
 
Fields inherited from class 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
 
Constructor Summary
CreateInitializerOperation(IType parentElement, java.lang.String source)
          When executed, this operation will create an initializer with the given name in the given type with the specified source.
 
Method Summary
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 initializer is positioned after the last existing initializer declaration, or as the first member in the type if there are no initializers.
protected  SimpleName rename(ASTNode node, SimpleName newName)
           
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.CreateTypeMemberOperation
generateSyntaxIncorrectAST, getChildPropertyDescriptor, getType, setAlteredName, verify, verifyNameCollision
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.CreateElementInCUOperation
checkCanceled, createAfter, createBefore, executeOperation, generateNewCompilationUnitAST, generateResultHandles, getCompilationUnit, getMainAmountOfWork, getSchedulingRule, insertASTNode, parse, setRelativePosition
 
Methods inherited from class 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, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numberOfInitializers

protected int numberOfInitializers
The current number of initializers in the parent type. Used to retrieve the handle of the newly created initializer.

Constructor Detail

CreateInitializerOperation

public CreateInitializerOperation(IType parentElement,
                                  java.lang.String source)
When executed, this operation will create an initializer with the given name in the given type with the specified source.

By default the new initializer is positioned after the last existing initializer declaration, or as the first member in the type if there are no initializers.

Method Detail

generateElementAST

protected ASTNode generateElementAST(ASTRewrite rewriter,
                                     ICompilationUnit cu)
                              throws JavaModelException
Overrides:
generateElementAST in class CreateTypeMemberOperation
Throws:
JavaModelException

generateResultHandle

protected IJavaElement generateResultHandle()
Description copied from class: CreateElementInCUOperation
Creates and returns the handle for the element this operation created.

Specified by:
generateResultHandle in class CreateElementInCUOperation
See Also:
CreateElementInCUOperation.generateResultHandle()

getMainTaskName

public java.lang.String getMainTaskName()
Description copied from class: CreateElementInCUOperation
Returns the name of the main task of this operation for progress reporting.

Specified by:
getMainTaskName in class CreateElementInCUOperation
See Also:
CreateElementInCUOperation.getMainTaskName()

rename

protected SimpleName rename(ASTNode node,
                            SimpleName newName)
Specified by:
rename in class CreateTypeMemberOperation

initializeDefaultPosition

protected void initializeDefaultPosition()
By default the new initializer is positioned after the last existing initializer declaration, or as the first member in the type if there are no initializers.

Overrides:
initializeDefaultPosition in class CreateElementInCUOperation