declNode= declNode.getParent();
ASTNode parent= declNode.getParent(); if (parent instanceof FieldDeclaration) { FieldDeclaration fieldDecl= (FieldDeclaration) parent; if (fieldDecl.fragments().size() > 1 && (fieldDecl.getParent() instanceof AbstractTypeDeclaration)) { VariableDeclarationFragment placeholder= (VariableDeclarationFragment) rewrite.createMoveTarget(declNode); FieldDeclaration newField= ast.newFieldDeclaration(placeholder); newField.setType((Type) ASTNode.copySubtree(ast, fieldDecl.getType())); newField.modifiers().addAll(ast.newModifiers((fieldDecl.getModifiers() & ~fExcludedModifiers) | fIncludedModifiers));  AbstractTypeDeclaration typeDecl= (AbstractTypeDeclaration) fieldDecl.getParent(); ListRewrite listRewrite= rewrite.getListRewrite(typeDecl, typeDecl.getBodyDeclarationsProperty()); if (fieldDecl.fragments().indexOf(declNode) == 0) { listRewrite.insertBefore(newField, parent, null); } else { listRewrite.insertAfter(newField, parent, null); } declNode= newField; return rewrite; } } else if (parent instanceof VariableDeclarationStatement) { VariableDeclarationStatement varDecl= (VariableDeclarationStatement) parent; if (varDecl.fragments().size() > 1 && (varDecl.getParent() instanceof Block)) { VariableDeclarationFragment placeholder= (VariableDeclarationFragment) rewrite.createMoveTarget(declNode); VariableDeclarationStatement newStat= ast.newVariableDeclarationStatement(placeholder); newStat.setType((Type) ASTNode.copySubtree(ast, varDecl.getType())); newStat.modifiers().addAll(ast.newModifiers((newStat.getModifiers() & ~fExcludedModifiers) | fIncludedModifiers));  ListRewrite listRewrite= rewrite.getListRewrite(varDecl.getParent(), Block.STATEMENTS_PROPERTY); if (varDecl.fragments().indexOf(declNode) == 0) { listRewrite.insertBefore(newStat, parent, null); } else { listRewrite.insertAfter(newStat, parent, null); } return rewrite; } } else if (parent instanceof VariableDeclarationExpression) {  } declNode= parent;
	protected ASTRewrite getRewrite() {		CompilationUnit astRoot= ASTResolving.findParentCompilationUnit(fNode);		ASTNode boundNode= astRoot.findDeclaringNode(fBinding);		ASTNode declNode= null;				TextEditGroup selectionDescription= null;				if (boundNode != null) {			declNode= boundNode; // is same CU		} else {			selectionDescription= new TextEditGroup("selection"); // in different CU, needs selection //$NON-NLS-1$			//setSelectionDescription(selectionDescription);			ASTParser astParser= ASTParser.newParser(ASTProvider.AST_LEVEL);			astParser.setSource(getCompilationUnit());			astParser.setResolveBindings(true);			CompilationUnit newRoot= (CompilationUnit) astParser.createAST(null);			declNode= newRoot.findDeclaringNode(fBinding.getKey());		}		if (declNode != null) {			if (declNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {				declNode= declNode.getParent();			}						ASTRewrite rewrite= ASTRewrite.create(declNode.getAST());						ModifierRewrite listRewrite= ModifierRewrite.create(rewrite, declNode);			listRewrite.setModifiers(fIncludedModifiers, fExcludedModifiers, selectionDescription);			return rewrite;		}		return null;	}