Example usage for org.eclipse.jdt.core.dom TryStatement RESOURCES_PROPERTY

List of usage examples for org.eclipse.jdt.core.dom TryStatement RESOURCES_PROPERTY

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom TryStatement RESOURCES_PROPERTY.

Prototype

ChildListPropertyDescriptor RESOURCES_PROPERTY

To view the source code for org.eclipse.jdt.core.dom TryStatement RESOURCES_PROPERTY.

Click Source Link

Document

The "resources" structural property of this node type (element type: VariableDeclarationExpression ) (added in JLS4 API).

Usage

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;
}