List of usage examples for org.eclipse.jdt.core.dom TryStatement RESOURCES_PROPERTY
ChildListPropertyDescriptor RESOURCES_PROPERTY
To view the source code for org.eclipse.jdt.core.dom TryStatement RESOURCES_PROPERTY.
Click Source Link
From source file:edu.illinois.jflow.core.transformations.code.ExtractClosureAnalyzer.java
License:Open Source License
@Override public void endVisit(VariableDeclarationExpression node) { if (getSelection().getEndVisitSelectionMode(node) == Selection.SELECTED && getFirstSelectedNode() == node) { if (node.getLocationInParent() == TryStatement.RESOURCES_PROPERTY) { invalidSelection(JFlowRefactoringCoreMessages.ExtractClosureAnalyzer_resource_in_try_with_resources, JavaStatusContext.create(fCUnit, getSelection())); }/*from w w w . j a v a2 s .co m*/ } checkTypeInDeclaration(node.getType()); super.endVisit(node); }
From source file:org.autorefactor.refactoring.rules.TryWithResourceRefactoring.java
License:Open Source License
private boolean refactorToTryWithResources(TryStatement node, VariableDeclarationExpression newResource, List<ASTNode> nodesToRemove) { if (newResource == null) { return VISIT_SUBTREE; }/*from w ww . ja v a 2s. c om*/ final Refactorings r = ctx.getRefactorings(); r.insertFirst(node, TryStatement.RESOURCES_PROPERTY, newResource); r.remove(nodesToRemove); return DO_NOT_VISIT_SUBTREE; }
From source file:org.autorefactor.refactoring.rules.TryWithResourceRefactoring.java
License:Open Source License
private boolean collapseTryStatements(TryStatement outerTryStmt, TryStatement innerTryStmt) { final Refactorings r = ctx.getRefactorings(); final ASTBuilder b = ctx.getASTBuilder(); r.insertLast(outerTryStmt, TryStatement.RESOURCES_PROPERTY, b.copyRange(resources(innerTryStmt))); r.replace(innerTryStmt, b.move(innerTryStmt.getBody())); return DO_NOT_VISIT_SUBTREE; }