public TempOccurrenceAnalyzer(VariableDeclaration tempDeclaration, boolean analyzeJavadoc){ Assert.isNotNull(tempDeclaration); fReferenceNodes= new HashSet<>(); fJavadocNodes= new HashSet<>(); fAnalyzeJavadoc= analyzeJavadoc; fTempDeclaration= tempDeclaration; fTempBinding= tempDeclaration.resolveBinding(); fIsInJavadoc= false; }
public TempOccurrenceAnalyzer(VariableDeclaration tempDeclaration, boolean analyzeJavadoc){ Assert.isNotNull(tempDeclaration); fReferenceNodes= new HashSet(); fJavadocNodes= new HashSet(); fAnalyzeJavadoc= analyzeJavadoc; fTempDeclaration= tempDeclaration; fTempBinding= tempDeclaration.resolveBinding(); fIsInJavadoc= false; }
public TempOccurrenceAnalyzer(VariableDeclaration tempDeclaration, boolean analyzeJavadoc){ Assert.isNotNull(tempDeclaration); fReferenceNodes= new HashSet<>(); fJavadocNodes= new HashSet<>(); fAnalyzeJavadoc= analyzeJavadoc; fTempDeclaration= tempDeclaration; fTempBinding= tempDeclaration.resolveBinding(); fIsInJavadoc= false; }
/** * Returns whether the provided variable declaration and expression represent the same local variable. * * @param varDecl the variable declaration to analyze * @param expr the expression to analyze * @return {@code true} if the provided nodes represent the same local variable, {@code false} otherwise */ public static boolean isSameLocalVariable(VariableDeclaration varDecl, Expression expr) { return varDecl != null && isSameLocalVariable(varDecl.resolveBinding(), expr); }
static IVariableBinding resolveBinding(VariableDeclaration variable) { IVariableBinding binding= variable.resolveBinding(); if (binding == null || binding.isRecovered()) throw new MissingBindingException(variable); return binding; }
public boolean visit(VariableDeclaration node) { if (hasFlag(VARIABLES, fFlags) && node.getStartPosition() < fPosition) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return !fBreak; }
@Override public boolean visit(VariableDeclaration node) { if (hasFlag(VARIABLES, fFlags) && node.getStartPosition() < fPosition) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return !fBreak; }
@Override public boolean visit(VariableDeclaration node) { if (hasFlag(VARIABLES, fFlags) && node.getStartPosition() < fPosition) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return !fBreak; }
private ITypeBinding getAnyTypeBinding(final ASTNode parsedNode) { if (parsedNode instanceof Expression) { return ((Expression) parsedNode).resolveTypeBinding(); } else if (parsedNode instanceof VariableDeclaration) { return ((VariableDeclaration) parsedNode).resolveBinding().getType(); } else { throw new NotImplementedException(parsedNode); } }
private static IBinding varBinding(ASTNode node) { switch (node.getNodeType()) { case FIELD_ACCESS: return ((FieldAccess) node).resolveFieldBinding(); case QUALIFIED_NAME: case SIMPLE_NAME: return ((Name) node).resolveBinding(); case SINGLE_VARIABLE_DECLARATION: case VARIABLE_DECLARATION_FRAGMENT: return ((VariableDeclaration) node).resolveBinding(); } return null; }
@Override public boolean visit(VariableDeclaration node) { if (hasFlag(VARIABLES, fFlags) && fPosition < node.getStartPosition()) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return false; }
@Override public boolean visit(VariableDeclaration node) { if (hasFlag(VARIABLES, fFlags) && fPosition < node.getStartPosition()) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return false; }
public boolean visit(VariableDeclaration node) { if (hasFlag(VARIABLES, fFlags) && fPosition < node.getStartPosition()) { fBreak= fRequestor.acceptBinding(node.resolveBinding()); } return false; }
public static SimpleName[] getProblemNodes(ASTNode methodNode, VariableDeclaration variableNode, TextEdit[] edits, TextChange change) { String key= variableNode.resolveBinding().getKey(); NameNodeVisitor visitor= new NameNodeVisitor(edits, change, key); methodNode.accept(visitor); return visitor.getProblemNodes(); }
public static SimpleName[] getProblemNodes(ASTNode methodNode, VariableDeclaration variableNode, TextEdit[] edits, TextChange change) { String key= variableNode.resolveBinding().getKey(); NameNodeVisitor visitor= new NameNodeVisitor(edits, change, key); methodNode.accept(visitor); return visitor.getProblemNodes(); }
public static SimpleName[] getProblemNodes(ASTNode methodNode, VariableDeclaration variableNode, TextEdit[] edits, TextChange change) { String key= variableNode.resolveBinding().getKey(); NameNodeVisitor visitor= new NameNodeVisitor(edits, change, key); methodNode.accept(visitor); return visitor.getProblemNodes(); }
public String[] guessFieldNames() { String rawTempName= StubUtility.getBaseName(fTempDeclarationNode.resolveBinding(), fCu.getJavaProject()); String[] excludedNames= getNamesOfFieldsInDeclaringType(); int dim= ASTNodes.getDimensions(fTempDeclarationNode); return StubUtility.getFieldNameSuggestions(fCu.getJavaProject(), rawTempName, dim, getModifiers(), excludedNames); }
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { initAST(); if (fTempDeclarationNode == null || fTempDeclarationNode.resolveBinding() == null) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameTempRefactoring_must_select_local); if (! Checks.isDeclaredIn(fTempDeclarationNode, MethodDeclaration.class) && ! Checks.isDeclaredIn(fTempDeclarationNode, Initializer.class)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameTempRefactoring_only_in_methods_and_initializers); initNames(); return new RefactoringStatus(); }
public String[] guessFieldNames() { String rawTempName= StubUtility.removePrefixAndSuffixForVariable(fCu.getJavaProject(), fTempDeclarationNode.resolveBinding()); String[] excludedNames= getNamesOfFieldsInDeclaringType(); int dim= ASTNodes.getDimensions(fTempDeclarationNode); return StubUtility.getFieldNameSuggestions(fCu.getJavaProject(), rawTempName, dim, getModifiers(), excludedNames); }
public String[] guessFieldNames() { String rawTempName= StubUtility.getBaseName(fTempDeclarationNode.resolveBinding(), fCu.getJavaProject()); String[] excludedNames= getNamesOfFieldsInDeclaringType(); int dim= ASTNodes.getDimensions(fTempDeclarationNode); return StubUtility.getFieldNameSuggestions(fCu.getJavaProject(), rawTempName, dim, getModifiers(), excludedNames); }