List of usage examples for org.eclipse.jdt.core.dom IfStatement ELSE_STATEMENT_PROPERTY
ChildPropertyDescriptor ELSE_STATEMENT_PROPERTY
To view the source code for org.eclipse.jdt.core.dom IfStatement ELSE_STATEMENT_PROPERTY.
Click Source Link
From source file:de.ovgu.cide.configuration.jdt.DeleteHiddenNodesVisitor.java
License:Open Source License
private void rewriteIfWhileEtc(ASTNode node, ASTNode parent, StructuralPropertyDescriptor prop, List<ASTNode> replacements) { Block replacement = node.getAST().newBlock(); rewrite.set(parent, prop, replacement, null); if (replacements.size() > 0) { ListRewrite blockRewriteList = getRewriteList(replacement, Block.STATEMENTS_PROPERTY); for (ASTNode s : replacements) for (ASTNode n : resolveBlock(s)) { blockRewriteList.insertLast(move(n), null); }/*www. j a v a 2s . co m*/ } else if (prop == IfStatement.ELSE_STATEMENT_PROPERTY) rewrite.set(parent, prop, null, null); }
From source file:org.jboss.tools.arquillian.ui.internal.refactoring.AddMissingTypeRefactoring.java
License:Open Source License
private void insertAt(ASTNode target, Statement declaration) { //ASTRewrite rewrite= fCURewrite.getASTRewrite(); //TextEditGroup groupDescription= fCURewrite.createGroupDescription(RefactoringCoreMessages.ExtractTempRefactoring_declare_local_variable); ASTNode parent = target.getParent(); StructuralPropertyDescriptor locationInParent = target.getLocationInParent(); while (locationInParent != Block.STATEMENTS_PROPERTY && locationInParent != SwitchStatement.STATEMENTS_PROPERTY) { if (locationInParent == IfStatement.THEN_STATEMENT_PROPERTY || locationInParent == IfStatement.ELSE_STATEMENT_PROPERTY || locationInParent == ForStatement.BODY_PROPERTY || locationInParent == EnhancedForStatement.BODY_PROPERTY || locationInParent == DoStatement.BODY_PROPERTY || locationInParent == WhileStatement.BODY_PROPERTY) { // create intermediate block if target was the body property of a control statement: Block replacement = rewrite.getAST().newBlock(); ListRewrite replacementRewrite = rewrite.getListRewrite(replacement, Block.STATEMENTS_PROPERTY); replacementRewrite.insertFirst(declaration, null); replacementRewrite.insertLast(rewrite.createMoveTarget(target), null); rewrite.replace(target, replacement, null); return; }/*from w ww .java 2 s .c o m*/ target = parent; parent = parent.getParent(); locationInParent = target.getLocationInParent(); } ListRewrite lw = rewrite.getListRewrite(parent, (ChildListPropertyDescriptor) locationInParent); lw.insertBefore(declaration, target, null); }