public Collection getUsedVariableNames(int offset, int length) { HashSet result= new HashSet(); IBinding[] bindingsBefore= getDeclarationsInScope(offset, VARIABLES); for (int i= 0; i < bindingsBefore.length; i++) { result.add(bindingsBefore[i].getName()); } IBinding[] bindingsAfter= getDeclarationsAfter(offset + length, VARIABLES); for (int i= 0; i < bindingsAfter.length; i++) { result.add(bindingsAfter[i].getName()); } List imports= fRoot.imports(); for (int i= 0; i < imports.size(); i++) { ImportDeclaration decl= (ImportDeclaration) imports.get(i); if (decl.isStatic() && !decl.isOnDemand()) { result.add(ASTNodes.getSimpleNameIdentifier(decl.getName())); } } return result; } }
public Collection<String> getUsedVariableNames(int offset, int length) { HashSet<String> result= new HashSet<>(); IBinding[] bindingsBefore= getDeclarationsInScope(offset, VARIABLES); for (int i= 0; i < bindingsBefore.length; i++) { result.add(bindingsBefore[i].getName()); } IBinding[] bindingsAfter= getDeclarationsAfter(offset + length, VARIABLES); for (int i= 0; i < bindingsAfter.length; i++) { result.add(bindingsAfter[i].getName()); } List<ImportDeclaration> imports= fRoot.imports(); for (int i= 0; i < imports.size(); i++) { ImportDeclaration decl= imports.get(i); if (decl.isStatic() && !decl.isOnDemand()) { result.add(ASTNodes.getSimpleNameIdentifier(decl.getName())); } } return result; } }
public Collection<String> getUsedVariableNames(int offset, int length) { HashSet<String> result= new HashSet<>(); IBinding[] bindingsBefore= getDeclarationsInScope(offset, VARIABLES); for (int i= 0; i < bindingsBefore.length; i++) { result.add(bindingsBefore[i].getName()); } IBinding[] bindingsAfter= getDeclarationsAfter(offset + length, VARIABLES); for (int i= 0; i < bindingsAfter.length; i++) { result.add(bindingsAfter[i].getName()); } List<ImportDeclaration> imports= fRoot.imports(); for (int i= 0; i < imports.size(); i++) { ImportDeclaration decl= imports.get(i); if (decl.isStatic() && !decl.isOnDemand()) { result.add(ASTNodes.getSimpleNameIdentifier(decl.getName())); } } return result; } }
/** * Returns the reserved identifiers in the method to move. * * @return the reserved identifiers * @throws JavaModelException * if the method declaration could not be found */ protected String[] computeReservedIdentifiers() throws JavaModelException { final List<String> names= new ArrayList<>(); final MethodDeclaration declaration= ASTNodeSearchUtil.getMethodDeclarationNode(fMethod, fSourceRewrite.getRoot()); if (declaration != null) { final List<SingleVariableDeclaration> parameters= declaration.parameters(); VariableDeclaration variable= null; for (int index= 0; index < parameters.size(); index++) { variable= parameters.get(index); names.add(variable.getName().getIdentifier()); } final Block body= declaration.getBody(); if (body != null) { final IBinding[] bindings= new ScopeAnalyzer(fSourceRewrite.getRoot()).getDeclarationsAfter(body.getStartPosition(), ScopeAnalyzer.VARIABLES); for (int index= 0; index < bindings.length; index++) names.add(bindings[index].getName()); } } final String[] result= new String[names.size()]; names.toArray(result); return result; }
/** * Returns the reserved identifiers in the method to move. * * @return the reserved identifiers * @throws JavaModelException * if the method declaration could not be found */ protected String[] computeReservedIdentifiers() throws JavaModelException { final List names= new ArrayList(); final MethodDeclaration declaration= ASTNodeSearchUtil.getMethodDeclarationNode(fMethod, fSourceRewrite.getRoot()); if (declaration != null) { final List parameters= declaration.parameters(); VariableDeclaration variable= null; for (int index= 0; index < parameters.size(); index++) { variable= (VariableDeclaration) parameters.get(index); names.add(variable.getName().getIdentifier()); } final Block body= declaration.getBody(); if (body != null) { final IBinding[] bindings= new ScopeAnalyzer(fSourceRewrite.getRoot()).getDeclarationsAfter(body.getStartPosition(), ScopeAnalyzer.VARIABLES); for (int index= 0; index < bindings.length; index++) names.add(bindings[index].getName()); } } final String[] result= new String[names.size()]; names.toArray(result); return result; }
/** * Returns the reserved identifiers in the method to move. * * @return the reserved identifiers * @throws JavaModelException * if the method declaration could not be found */ protected String[] computeReservedIdentifiers() throws JavaModelException { final List<String> names= new ArrayList<>(); final MethodDeclaration declaration= ASTNodeSearchUtil.getMethodDeclarationNode(fMethod, fSourceRewrite.getRoot()); if (declaration != null) { final List<SingleVariableDeclaration> parameters= declaration.parameters(); VariableDeclaration variable= null; for (int index= 0; index < parameters.size(); index++) { variable= parameters.get(index); names.add(variable.getName().getIdentifier()); } final Block body= declaration.getBody(); if (body != null) { final IBinding[] bindings= new ScopeAnalyzer(fSourceRewrite.getRoot()).getDeclarationsAfter(body.getStartPosition(), ScopeAnalyzer.VARIABLES); for (int index= 0; index < bindings.length; index++) names.add(bindings[index].getName()); } } final String[] result= new String[names.size()]; names.toArray(result); return result; }
IBinding[] bindings= (new ScopeAnalyzer(root)).getDeclarationsAfter(methodDecl.getBody().getStartPosition(), ScopeAnalyzer.VARIABLES); for (int i= 0; i < bindings.length; i++) { usedNames.add(bindings[i].getName());
IBinding[] bindings= (new ScopeAnalyzer(root)).getDeclarationsAfter(methodDecl.getBody().getStartPosition(), ScopeAnalyzer.VARIABLES); for (int i= 0; i < bindings.length; i++) { usedNames.add(bindings[i].getName());
IBinding[] bindings= (new ScopeAnalyzer(root)).getDeclarationsAfter(methodDecl.getBody().getStartPosition(), ScopeAnalyzer.VARIABLES); for (int i= 0; i < bindings.length; i++) { usedNames.add(bindings[i].getName());
IBinding[] bindings= (new ScopeAnalyzer(root)).getDeclarationsAfter(methodDecl.getBody().getStartPosition(), ScopeAnalyzer.VARIABLES); for (int i= 0; i < bindings.length; i++) { usedNames.add(bindings[i].getName());