Example usage for org.eclipse.jdt.core.dom NodeFinder perform

List of usage examples for org.eclipse.jdt.core.dom NodeFinder perform

Introduction

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

Prototype

public static ASTNode perform(ASTNode root, int start, int length, ITypeRoot source) throws JavaModelException 

Source Link

Document

Maps a selection to an ASTNode, where the selection is given by a start and a length.

Usage

From source file:edu.illinois.compositerefactorings.refactorings.usesupertypeininstanceof.UseSuperTypeInInstanceOfRefactoring.java

License:Open Source License

private static ASTNode getSelectedNode(ICompilationUnit unit, CompilationUnit root, int offset, int length) {
    ASTNode node = null;/* www  .jav  a2 s  .c om*/
    try {
        if (unit != null)
            node = checkNode(NodeFinder.perform(root, offset, length, unit));
        else
            node = checkNode(NodeFinder.perform(root, offset, length));
    } catch (JavaModelException e) {
        // Do nothing
    }
    if (node != null)
        return node;
    return checkNode(NodeFinder.perform(root, offset, length));
}