public Scope getScope() throws IOException { if (scope == null) { controller.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED); scope = controller.getTreeUtilities().scopeFor(offset); } return scope; }
if (doc != null) { offset = findLineOffset(doc, line); scope = ci.getTreeUtilities().scopeFor(offset);
te = (TypeElement) ci.getTrees().getElement(currentPath); } else { Scope scope = ci.getTreeUtilities().scopeFor(currentOffset); te = scope.getEnclosingClass(); Scope scope = ci.getTreeUtilities().scopeFor(currentOffset); el = scope.getEnclosingMethod(); if (el != null) { IdentifierTree it = (IdentifierTree) tree; String fieldName = it.getName().toString(); Scope scope = ci.getTreeUtilities().scopeFor(offset); TypeElement te = scope.getEnclosingClass(); if (te != null) {
te = (TypeElement) ci.getTrees().getElement(p); } else { Scope scope = ci.getTreeUtilities().scopeFor(offset); te = scope.getEnclosingClass();
private MethodArgument[] computeMethodArguments(CompilationController ci, int methodLineNumber, int offset) throws IOException { MethodArgument args[]; if (ci.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Unable to resolve "+ci.getFileObject()+" to phase "+Phase.RESOLVED+", current phase = "+ci.getPhase()+ "\nDiagnostics = "+ci.getDiagnostics()+ "\nFree memory = "+Runtime.getRuntime().freeMemory()); return null; } Scope scope = ci.getTreeUtilities().scopeFor(offset); Element clazz = scope.getEnclosingClass(); if (clazz == null) { return null; } Tree methodTree = ci.getTrees().getTree(clazz); CompilationUnitTree cu = ci.getCompilationUnit(); MethodArgumentsScanner scanner = new MethodArgumentsScanner(methodLineNumber, cu, ci.getTrees().getSourcePositions(), false, new OperationCreationDelegateImpl()); args = methodTree.accept(scanner, null); args = scanner.getArguments(); return args; }
private MethodArgument[] computeMethodArguments(CompilationController ci, Operation operation) throws IOException { MethodArgument args[]; if (ci.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Unable to resolve "+ci.getFileObject()+" to phase "+Phase.RESOLVED+", current phase = "+ci.getPhase()+ "\nDiagnostics = "+ci.getDiagnostics()+ "\nFree memory = "+Runtime.getRuntime().freeMemory()); return null; } int offset = operation.getMethodEndPosition().getOffset(); Scope scope = ci.getTreeUtilities().scopeFor(offset); Element method = scope.getEnclosingMethod(); if (method == null) { return null; } Tree methodTree = ci.getTrees().getTree(method); CompilationUnitTree cu = ci.getCompilationUnit(); MethodArgumentsScanner scanner = new MethodArgumentsScanner(offset, cu, ci.getTrees().getSourcePositions(), true, new OperationCreationDelegateImpl()); args = methodTree.accept(scanner, null); args = scanner.getArguments(); return args; }
logger.log(Level.FINE, "Statement tree found at line {0}:\n{1}\n", new Object[]{ lineNumber, statementTree }); if (statementTree == null) { Scope scope = ci.getTreeUtilities().scopeFor(offset); Element method = scope.getEnclosingMethod(); if (method == null) {