本文整理汇总了Java中org.eclipse.jdt.core.dom.Assignment.setLeftHandSide方法的典型用法代码示例。如果您正苦于以下问题:Java Assignment.setLeftHandSide方法的具体用法?Java Assignment.setLeftHandSide怎么用?Java Assignment.setLeftHandSide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.Assignment
的用法示例。
在下文中一共展示了Assignment.setLeftHandSide方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWithMethodBody
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private Block createWithMethodBody(AST ast, BuilderField builderField) {
String originalFieldName = builderField.getOriginalFieldName();
String builderFieldName = builderField.getBuilderFieldName();
Block newBlock = ast.newBlock();
ReturnStatement builderReturnStatement = ast.newReturnStatement();
builderReturnStatement.setExpression(ast.newThisExpression());
Assignment newAssignment = ast.newAssignment();
FieldAccess fieldAccess = ast.newFieldAccess();
fieldAccess.setExpression(ast.newThisExpression());
fieldAccess.setName(ast.newSimpleName(originalFieldName));
newAssignment.setLeftHandSide(fieldAccess);
newAssignment.setRightHandSide(ast.newSimpleName(builderFieldName));
newBlock.statements().add(ast.newExpressionStatement(newAssignment));
newBlock.statements().add(builderReturnStatement);
return newBlock;
}
示例2: createWithMethodBody
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private Block createWithMethodBody(AST ast, String originalFieldName, String builderFieldName) {
Block newBlock = ast.newBlock();
ReturnStatement builderReturnStatement = ast.newReturnStatement();
builderReturnStatement.setExpression(ast.newThisExpression());
Assignment newAssignment = ast.newAssignment();
FieldAccess fieldAccess = ast.newFieldAccess();
fieldAccess.setExpression(ast.newThisExpression());
fieldAccess.setName(ast.newSimpleName(originalFieldName));
newAssignment.setLeftHandSide(fieldAccess);
newAssignment.setRightHandSide(ast.newSimpleName(builderFieldName));
newBlock.statements().add(ast.newExpressionStatement(newAssignment));
newBlock.statements().add(builderReturnStatement);
return newBlock;
}
示例3: newFieldAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private Statement newFieldAssignment(
AST ast, SimpleName fieldNameNode, Expression initializer, boolean useThisAccess) {
Assignment assignment = ast.newAssignment();
if (useThisAccess) {
FieldAccess access = ast.newFieldAccess();
access.setExpression(ast.newThisExpression());
access.setName(fieldNameNode);
assignment.setLeftHandSide(access);
} else {
assignment.setLeftHandSide(fieldNameNode);
}
assignment.setOperator(Assignment.Operator.ASSIGN);
assignment.setRightHandSide(initializer);
return ast.newExpressionStatement(assignment);
}
示例4: getIteratorBasedForBodyAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
/**
* Generates the Assignment in an iterator based for, used in the first statement of an iterator
* based <code>for</code> loop body, to retrieve the next element of the {@link Iterable}
* instance.
*
* @param rewrite the current instance of {@link ASTRewrite}
* @param loopOverType the {@link ITypeBinding} of the loop variable
* @param loopVariableName the name of the loop variable
* @return an {@link Assignment}, which retrieves the next element of the {@link Iterable} using
* the active {@link Iterator}
*/
private Assignment getIteratorBasedForBodyAssignment(
ASTRewrite rewrite, ITypeBinding loopOverType, SimpleName loopVariableName) {
AST ast = rewrite.getAST();
Assignment assignResolvedVariable = ast.newAssignment();
// left hand side
SimpleName resolvedVariableName =
resolveLinkedVariableNameWithProposals(
rewrite, loopOverType.getName(), loopVariableName.getIdentifier(), false);
VariableDeclarationFragment resolvedVariableDeclarationFragment =
ast.newVariableDeclarationFragment();
resolvedVariableDeclarationFragment.setName(resolvedVariableName);
VariableDeclarationExpression resolvedVariableDeclaration =
ast.newVariableDeclarationExpression(resolvedVariableDeclarationFragment);
resolvedVariableDeclaration.setType(
getImportRewrite()
.addImport(
loopOverType,
ast,
new ContextSensitiveImportRewriteContext(fCurrentNode, getImportRewrite())));
assignResolvedVariable.setLeftHandSide(resolvedVariableDeclaration);
// right hand side
MethodInvocation invokeIteratorNextExpression = ast.newMethodInvocation();
invokeIteratorNextExpression.setName(ast.newSimpleName("next")); // $NON-NLS-1$
SimpleName currentElementName = ast.newSimpleName(loopVariableName.getIdentifier());
addLinkedPosition(
rewrite.track(currentElementName),
LinkedPositionGroup.NO_STOP,
currentElementName.getIdentifier());
invokeIteratorNextExpression.setExpression(currentElementName);
assignResolvedVariable.setRightHandSide(invokeIteratorNextExpression);
assignResolvedVariable.setOperator(Assignment.Operator.ASSIGN);
return assignResolvedVariable;
}
示例5: getForBodyAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
/**
* Creates an {@link Assignment} as first expression appearing in a <code>for</code> loop's body.
* This Assignment declares a local variable and initializes it using the array's current element
* identified by the loop index.
*
* @param rewrite the current {@link ASTRewrite} instance
* @param loopVariableName the name of the index variable in String representation
* @return a completed {@link Assignment} containing the mentioned declaration and initialization
*/
private Assignment getForBodyAssignment(ASTRewrite rewrite, SimpleName loopVariableName) {
AST ast = rewrite.getAST();
ITypeBinding loopOverType = extractElementType(ast);
Assignment assignResolvedVariable = ast.newAssignment();
// left hand side
SimpleName resolvedVariableName =
resolveLinkedVariableNameWithProposals(
rewrite, loopOverType.getName(), loopVariableName.getIdentifier(), false);
VariableDeclarationFragment resolvedVariableDeclarationFragment =
ast.newVariableDeclarationFragment();
resolvedVariableDeclarationFragment.setName(resolvedVariableName);
VariableDeclarationExpression resolvedVariableDeclaration =
ast.newVariableDeclarationExpression(resolvedVariableDeclarationFragment);
resolvedVariableDeclaration.setType(
getImportRewrite()
.addImport(
loopOverType,
ast,
new ContextSensitiveImportRewriteContext(fCurrentNode, getImportRewrite())));
assignResolvedVariable.setLeftHandSide(resolvedVariableDeclaration);
// right hand side
ArrayAccess access = ast.newArrayAccess();
access.setArray((Expression) rewrite.createCopyTarget(fCurrentExpression));
SimpleName indexName = ast.newSimpleName(loopVariableName.getIdentifier());
addLinkedPosition(
rewrite.track(indexName), LinkedPositionGroup.NO_STOP, indexName.getIdentifier());
access.setIndex(indexName);
assignResolvedVariable.setRightHandSide(access);
assignResolvedVariable.setOperator(Assignment.Operator.ASSIGN);
return assignResolvedVariable;
}
示例6: getIndexBasedForBodyAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
/**
* Creates an {@link Assignment} as first expression appearing in an index based <code>for</code>
* loop's body. This Assignment declares a local variable and initializes it using the {@link
* List}'s current element identified by the loop index.
*
* @param rewrite the current {@link ASTRewrite} instance
* @param loopVariableName the name of the index variable in String representation
* @return a completed {@link Assignment} containing the mentioned declaration and initialization
*/
private Expression getIndexBasedForBodyAssignment(
ASTRewrite rewrite, SimpleName loopVariableName) {
AST ast = rewrite.getAST();
ITypeBinding loopOverType = extractElementType(ast);
Assignment assignResolvedVariable = ast.newAssignment();
// left hand side
SimpleName resolvedVariableName =
resolveLinkedVariableNameWithProposals(
rewrite, loopOverType.getName(), loopVariableName.getIdentifier(), false);
VariableDeclarationFragment resolvedVariableDeclarationFragment =
ast.newVariableDeclarationFragment();
resolvedVariableDeclarationFragment.setName(resolvedVariableName);
VariableDeclarationExpression resolvedVariableDeclaration =
ast.newVariableDeclarationExpression(resolvedVariableDeclarationFragment);
resolvedVariableDeclaration.setType(
getImportRewrite()
.addImport(
loopOverType,
ast,
new ContextSensitiveImportRewriteContext(fCurrentNode, getImportRewrite())));
assignResolvedVariable.setLeftHandSide(resolvedVariableDeclaration);
// right hand side
MethodInvocation invokeGetExpression = ast.newMethodInvocation();
invokeGetExpression.setName(ast.newSimpleName("get")); // $NON-NLS-1$
SimpleName indexVariableName = ast.newSimpleName(loopVariableName.getIdentifier());
addLinkedPosition(
rewrite.track(indexVariableName),
LinkedPositionGroup.NO_STOP,
indexVariableName.getIdentifier());
invokeGetExpression.arguments().add(indexVariableName);
invokeGetExpression.setExpression((Expression) rewrite.createCopyTarget(fCurrentExpression));
assignResolvedVariable.setRightHandSide(invokeGetExpression);
assignResolvedVariable.setOperator(Assignment.Operator.ASSIGN);
return assignResolvedVariable;
}
示例7: createArrayInitStmt
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
@Override
public void createArrayInitStmt(final CaptureLog log, final int logRecNo) {
final int oid = log.objectIds.get(logRecNo);
final Object[] params = log.params.get(logRecNo);
final String arrTypeName = log.oidClassNames.get(log.oidRecMapping.get(oid));
final Class<?> arrType = getClassForName(arrTypeName);
// --- create array instance creation e.g. int[] var = new int[10];
final ArrayType arrAstType = (ArrayType) createAstArrayType(arrTypeName, ast);
final ArrayCreation arrCreationExpr = ast.newArrayCreation();
arrCreationExpr.setType(arrAstType);
arrCreationExpr.dimensions().add(ast.newNumberLiteral(String.valueOf(params.length)));
final String arrVarName = this.createNewVarName(oid, arrTypeName);
final VariableDeclarationFragment vd = ast.newVariableDeclarationFragment();
final SimpleName arrVarNameExpr = ast.newSimpleName(arrVarName);
vd.setName(arrVarNameExpr);
vd.setInitializer(arrCreationExpr);
final VariableDeclarationStatement varDeclStmt = ast.newVariableDeclarationStatement(vd);
varDeclStmt.setType(this.createAstType(arrTypeName, ast));
methodBlock.statements().add(varDeclStmt);
// create array access statements var[0] = var1;
Integer paramOID;
Assignment assign;
ArrayAccess arrAccessExpr;
for(int i = 0; i < params.length; i++)
{
assign = ast.newAssignment();
arrAccessExpr = ast.newArrayAccess();
arrAccessExpr.setIndex(ast.newNumberLiteral(String.valueOf(i)));
arrAccessExpr.setArray(arrVarNameExpr);
assign.setLeftHandSide(arrAccessExpr);
paramOID = (Integer) params[i];
if(paramOID == null)
{
assign.setRightHandSide(ast.newNullLiteral());
}
else
{
assign.setRightHandSide(ast.newSimpleName(this.oidToVarMapping.get(paramOID)));
}
methodBlock.statements().add(assign);
}
}
示例8: prepareAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private Statement prepareAssignment(Expression rightHand) {
// result = PRIME*result + (...)
InfixExpression mul= fAst.newInfixExpression();
mul.setLeftOperand(fAst.newSimpleName(VARIABLE_NAME_PRIME));
mul.setRightOperand(fAst.newSimpleName(VARIABLE_NAME_RESULT));
mul.setOperator(Operator.TIMES);
Assignment ass= fAst.newAssignment();
ass.setLeftHandSide(fAst.newSimpleName(VARIABLE_NAME_RESULT));
InfixExpression plus= fAst.newInfixExpression();
plus.setLeftOperand(mul);
plus.setOperator(Operator.PLUS);
plus.setRightOperand(rightHand);
ass.setRightHandSide(plus);
return fAst.newExpressionStatement(ass);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:GenerateHashCodeEqualsOperation.java
示例9: makeSelfAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private Statement makeSelfAssignment(ASTRewrite rewrite, ReturnValueResolutionVisitor rvrFinder) {
AST rootNode = rewrite.getAST();
Assignment newAssignment = rootNode.newAssignment();
Expression leftExpression = rvrFinder.badMethodInvocation.getExpression();
while (leftExpression instanceof MethodInvocation) {
leftExpression = ((MethodInvocation) leftExpression).getExpression();
}
newAssignment.setLeftHandSide((Expression) rewrite.createCopyTarget(leftExpression));
newAssignment.setRightHandSide((Expression) rewrite.createCopyTarget(
rvrFinder.badMethodInvocation));
return rootNode.newExpressionStatement(newAssignment);
}
示例10: getIteratorBasedForBodyAssignment
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
/**
* Generates the Assignment in an iterator based for, used in the first statement of an iterator
* based <code>for</code> loop body, to retrieve the next element of the {@link Iterable}
* instance.
*
* @param rewrite the current instance of {@link ASTRewrite}
* @param loopOverType the {@link ITypeBinding} of the loop variable
* @param loopVariableName the name of the loop variable
* @return an {@link Assignment}, which retrieves the next element of the {@link Iterable} using
* the active {@link Iterator}
*/
private Assignment getIteratorBasedForBodyAssignment(ASTRewrite rewrite, ITypeBinding loopOverType, SimpleName loopVariableName) {
AST ast= rewrite.getAST();
Assignment assignResolvedVariable= ast.newAssignment();
// left hand side
SimpleName resolvedVariableName= resolveLinkedVariableNameWithProposals(rewrite, loopOverType.getName(), loopVariableName.getIdentifier(), false);
VariableDeclarationFragment resolvedVariableDeclarationFragment= ast.newVariableDeclarationFragment();
resolvedVariableDeclarationFragment.setName(resolvedVariableName);
VariableDeclarationExpression resolvedVariableDeclaration= ast.newVariableDeclarationExpression(resolvedVariableDeclarationFragment);
resolvedVariableDeclaration.setType(getImportRewrite().addImport(loopOverType, ast, new ContextSensitiveImportRewriteContext(fCurrentNode, getImportRewrite())));
assignResolvedVariable.setLeftHandSide(resolvedVariableDeclaration);
// right hand side
MethodInvocation invokeIteratorNextExpression= ast.newMethodInvocation();
invokeIteratorNextExpression.setName(ast.newSimpleName("next")); //$NON-NLS-1$
SimpleName currentElementName= ast.newSimpleName(loopVariableName.getIdentifier());
addLinkedPosition(rewrite.track(currentElementName), LinkedPositionGroup.NO_STOP, currentElementName.getIdentifier());
invokeIteratorNextExpression.setExpression(currentElementName);
assignResolvedVariable.setRightHandSide(invokeIteratorNextExpression);
assignResolvedVariable.setOperator(Assignment.Operator.ASSIGN);
return assignResolvedVariable;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:GenerateForLoopAssistProposal.java
示例11: populateBodyWithFieldSetCalls
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private void populateBodyWithFieldSetCalls(AST ast, TypeDeclaration builderType, Block body, List<ClassFieldSetterBuilderField> builderFields) {
for (BuilderField field : builderFields) {
Assignment assignment = ast.newAssignment();
FieldAccess fieldAccess = createThisFieldAccess(ast, field);
assignment.setLeftHandSide(fieldAccess);
FieldAccess builderFieldAccess = createBuilderFieldAccess(ast, builderType, field);
assignment.setRightHandSide(builderFieldAccess);
body.statements().add(ast.newExpressionStatement(assignment));
}
}
示例12: createCallNodes
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private ASTNode[] createCallNodes(SnippetFinder.Match duplicate, int modifiers) {
List<ASTNode> result = new ArrayList<>(2);
IVariableBinding[] locals = fAnalyzer.getCallerLocals();
for (int i = 0; i < locals.length; i++) {
result.add(createDeclaration(locals[i], null));
}
MethodInvocation invocation = fAST.newMethodInvocation();
invocation.setName(fAST.newSimpleName(fMethodName));
ASTNode typeNode = ASTResolving.findParentType(fAnalyzer.getEnclosingBodyDeclaration());
RefactoringStatus status = new RefactoringStatus();
while (fDestination != typeNode) {
fAnalyzer.checkInput(status, fMethodName, typeNode);
if (!status.isOK()) {
SimpleName destinationTypeName = fAST.newSimpleName(ASTNodes.getEnclosingType(fDestination).getName());
if ((modifiers & Modifier.STATIC) == 0) {
ThisExpression thisExpression = fAST.newThisExpression();
thisExpression.setQualifier(destinationTypeName);
invocation.setExpression(thisExpression);
} else {
invocation.setExpression(destinationTypeName);
}
break;
}
typeNode = typeNode.getParent();
}
List<Expression> arguments = invocation.arguments();
for (int i = 0; i < fParameterInfos.size(); i++) {
ParameterInfo parameter = fParameterInfos.get(i);
arguments.add(ASTNodeFactory.newName(fAST, getMappedName(duplicate, parameter)));
}
if (fLinkedProposalModel != null) {
LinkedProposalPositionGroup nameGroup = fLinkedProposalModel.getPositionGroup(KEY_NAME, true);
nameGroup.addPosition(fRewriter.track(invocation.getName()), false);
}
ASTNode call;
int returnKind = fAnalyzer.getReturnKind();
switch (returnKind) {
case ExtractMethodAnalyzer.ACCESS_TO_LOCAL:
IVariableBinding binding = fAnalyzer.getReturnLocal();
if (binding != null) {
VariableDeclarationStatement decl = createDeclaration(getMappedBinding(duplicate, binding), invocation);
call = decl;
} else {
Assignment assignment = fAST.newAssignment();
assignment.setLeftHandSide(ASTNodeFactory.newName(fAST, getMappedBinding(duplicate, fAnalyzer.getReturnValue()).getName()));
assignment.setRightHandSide(invocation);
call = assignment;
}
break;
case ExtractMethodAnalyzer.RETURN_STATEMENT_VALUE:
ReturnStatement rs = fAST.newReturnStatement();
rs.setExpression(invocation);
call = rs;
break;
default:
call = invocation;
}
if (call instanceof Expression && !fAnalyzer.isExpressionSelected()) {
call = fAST.newExpressionStatement((Expression) call);
}
result.add(call);
// We have a void return statement. The code looks like
// extracted();
// return;
if (returnKind == ExtractMethodAnalyzer.RETURN_STATEMENT_VOID && !fAnalyzer.isLastStatementSelected()) {
result.add(fAST.newReturnStatement());
}
return result.toArray(new ASTNode[result.size()]);
}
示例13: createNewAssignmentStatement
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private Statement createNewAssignmentStatement(ASTRewrite rewrite) {
AST ast = getAST();
Assignment assignment = ast.newAssignment();
SimpleName fieldName = ast.newSimpleName(fFieldName);
addLinkedName(rewrite, fieldName, true);
assignment.setLeftHandSide(fieldName);
assignment.setRightHandSide(getTempInitializerCopy(rewrite));
return ast.newExpressionStatement(assignment);
}
示例14: createCallNodes
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private ASTNode[] createCallNodes(SnippetFinder.Match duplicate, int modifiers) {
List<ASTNode> result = new ArrayList<ASTNode>(2);
IVariableBinding[] locals = fAnalyzer.getCallerLocals();
for (int i = 0; i < locals.length; i++) {
result.add(createDeclaration(locals[i], null));
}
MethodInvocation invocation = fAST.newMethodInvocation();
invocation.setName(fAST.newSimpleName(fMethodName));
ASTNode typeNode = ASTResolving.findParentType(fAnalyzer.getEnclosingBodyDeclaration());
RefactoringStatus status = new RefactoringStatus();
while (fDestination != typeNode) {
fAnalyzer.checkInput(status, fMethodName, typeNode);
if (!status.isOK()) {
SimpleName destinationTypeName =
fAST.newSimpleName(ASTNodes.getEnclosingType(fDestination).getName());
if ((modifiers & Modifier.STATIC) == 0) {
ThisExpression thisExpression = fAST.newThisExpression();
thisExpression.setQualifier(destinationTypeName);
invocation.setExpression(thisExpression);
} else {
invocation.setExpression(destinationTypeName);
}
break;
}
typeNode = typeNode.getParent();
}
List<Expression> arguments = invocation.arguments();
for (int i = 0; i < fParameterInfos.size(); i++) {
ParameterInfo parameter = fParameterInfos.get(i);
arguments.add(ASTNodeFactory.newName(fAST, getMappedName(duplicate, parameter)));
}
if (fLinkedProposalModel != null) {
LinkedProposalPositionGroup nameGroup = fLinkedProposalModel.getPositionGroup(KEY_NAME, true);
nameGroup.addPosition(fRewriter.track(invocation.getName()), false);
}
ASTNode call;
int returnKind = fAnalyzer.getReturnKind();
switch (returnKind) {
case ExtractMethodAnalyzer.ACCESS_TO_LOCAL:
IVariableBinding binding = fAnalyzer.getReturnLocal();
if (binding != null) {
VariableDeclarationStatement decl =
createDeclaration(getMappedBinding(duplicate, binding), invocation);
call = decl;
} else {
Assignment assignment = fAST.newAssignment();
assignment.setLeftHandSide(
ASTNodeFactory.newName(
fAST, getMappedBinding(duplicate, fAnalyzer.getReturnValue()).getName()));
assignment.setRightHandSide(invocation);
call = assignment;
}
break;
case ExtractMethodAnalyzer.RETURN_STATEMENT_VALUE:
ReturnStatement rs = fAST.newReturnStatement();
rs.setExpression(invocation);
call = rs;
break;
default:
call = invocation;
}
if (call instanceof Expression && !fAnalyzer.isExpressionSelected()) {
call = fAST.newExpressionStatement((Expression) call);
}
result.add(call);
// We have a void return statement. The code looks like
// extracted();
// return;
if (returnKind == ExtractMethodAnalyzer.RETURN_STATEMENT_VOID
&& !fAnalyzer.isLastStatementSelected()) {
result.add(fAST.newReturnStatement());
}
return result.toArray(new ASTNode[result.size()]);
}
示例15: createConstructor
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private void createConstructor(final AbstractTypeDeclaration declaration, final ASTRewrite rewrite) throws CoreException {
Assert.isNotNull(declaration);
Assert.isNotNull(rewrite);
final AST ast= declaration.getAST();
final MethodDeclaration constructor= ast.newMethodDeclaration();
constructor.setConstructor(true);
constructor.setName(ast.newSimpleName(declaration.getName().getIdentifier()));
final String comment= CodeGeneration.getMethodComment(fType.getCompilationUnit(), fType.getElementName(), fType.getElementName(), getNewConstructorParameterNames(), new String[0], null, null, StubUtility.getLineDelimiterUsed(fType.getJavaProject()));
if (comment != null && comment.length() > 0) {
final Javadoc doc= (Javadoc) rewrite.createStringPlaceholder(comment, ASTNode.JAVADOC);
constructor.setJavadoc(doc);
}
if (fCreateInstanceField) {
final SingleVariableDeclaration variable= ast.newSingleVariableDeclaration();
final String name= getNameForEnclosingInstanceConstructorParameter();
variable.setName(ast.newSimpleName(name));
variable.setType(createEnclosingType(ast));
constructor.parameters().add(variable);
final Block body= ast.newBlock();
final Assignment assignment= ast.newAssignment();
if (fCodeGenerationSettings.useKeywordThis || fEnclosingInstanceFieldName.equals(fNameForEnclosingInstanceConstructorParameter)) {
final FieldAccess access= ast.newFieldAccess();
access.setExpression(ast.newThisExpression());
access.setName(ast.newSimpleName(fEnclosingInstanceFieldName));
assignment.setLeftHandSide(access);
} else
assignment.setLeftHandSide(ast.newSimpleName(fEnclosingInstanceFieldName));
assignment.setRightHandSide(ast.newSimpleName(name));
final Statement statement= ast.newExpressionStatement(assignment);
body.statements().add(statement);
constructor.setBody(body);
} else
constructor.setBody(ast.newBlock());
rewrite.getListRewrite(declaration, declaration.getBodyDeclarationsProperty()).insertFirst(constructor, null);
}