assignedName= ((VariableDeclarationFragment) parent).getName().getIdentifier(); }
otherNameInAssign= ((VariableDeclarationFragment) parent).getName().getIdentifier(); } else if (parent.getNodeType() == ASTNode.ASSIGNMENT) { Assignment assignment= (Assignment) parent; if (isWriteAccess && assignment.getRightHandSide() instanceof SimpleName) { otherNameInAssign= ((SimpleName) assignment.getRightHandSide()).getIdentifier(); } else if (!isWriteAccess && assignment.getLeftHandSide() instanceof SimpleName) { otherNameInAssign= ((SimpleName) assignment.getLeftHandSide()).getIdentifier(); } }
	private static void addSimilarVariableProposals(ICompilationUnit cu, CompilationUnit astRoot, SimpleName node, Collection proposals) {		IBinding[] varsInScope= (new ScopeAnalyzer(astRoot)).getDeclarationsInScope(node, ScopeAnalyzer.VARIABLES);		if (varsInScope.length > 0) {			// avoid corrections like int i= i;			String assignedName= null;			ASTNode parent= node.getParent();			if (parent.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {				assignedName= ((VariableDeclarationFragment) parent).getName().getIdentifier();			}									ITypeBinding guessedType= ASTResolving.guessBindingForReference(node);			if (astRoot.getAST().resolveWellKnownType("java.lang.Object") == guessedType) { //$NON-NLS-1$				guessedType= null; // too many suggestions			}						String identifier= node.getIdentifier();			for (int i= 0; i < varsInScope.length; i++) {				IVariableBinding curr= (IVariableBinding) varsInScope[i];				String currName= curr.getName();				if (!currName.equals(assignedName)) {					int relevance= 0;					if (NameMatcher.isSimilarName(currName, identifier)) {						relevance += 3; // variable with a similar name than the unresolved variable					}					ITypeBinding varType= curr.getType();					if (guessedType != null && varType != null && TypeRules.canAssign(guessedType, varType)) {						relevance += 2; // unresolved variable can be assign to this variable 											}					if (relevance > 0) {						String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.changevariable.description", currName); //$NON-NLS-1$						proposals.add(new ReplaceCorrectionProposal(label, cu, node.getStartPosition(), node.getLength(), currName, relevance));					}				}			}					}	}