ProblemPosition newProblemPos= createProblemPosition(node, problemPos); addSimilarTypeProposals(elements, node.getIdentifier(), newProblemPos, proposals); addNewTypeProposals(node.getIdentifier(), newProblemPos, SimilarElementsRequestor.REF_TYPES, proposals);
addSimilarTypeProposals(elements, cu, node, proposals); addNewTypeProposals(cu, node, SimilarElementsRequestor.REF_TYPES, proposals);
	public static void getVariableProposals(ProblemPosition problemPos, ArrayList proposals) throws CoreException {				ICompilationUnit cu= problemPos.getCompilationUnit();				CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);		ASTNode selectedNode= ASTResolving.findSelectedNode(astRoot, problemPos.getOffset(), problemPos.getLength());		int similarNodeKind= SimilarElementsRequestor.VARIABLES;		SimpleName node= null;		if (selectedNode instanceof SimpleName) {			node= (SimpleName) selectedNode;			ASTNode parent= node.getParent();			if (parent instanceof MethodInvocation && node.equals(((MethodInvocation)parent).getExpression())) {				similarNodeKind |= SimilarElementsRequestor.CLASSES;			}		} else if (selectedNode instanceof QualifiedName) {			QualifiedName qualifierName= (QualifiedName) selectedNode;			Name qualifier= qualifierName.getQualifier();			if (qualifier instanceof SimpleName) {				node= (SimpleName) qualifier;				similarNodeKind |= SimilarElementsRequestor.REF_TYPES;			}		} else if (selectedNode instanceof FieldAccess) {			FieldAccess access= (FieldAccess) selectedNode;			Expression expression= access.getExpression();			if (expression == null || expression instanceof ThisExpression) {				node= access.getName();			}		}						if (node == null) {			return;		}		// corrections		SimilarElement[] elements= SimilarElementsRequestor.findSimilarElement(cu, node, similarNodeKind);		for (int i= 0; i < elements.length; i++) {			SimilarElement curr= elements[i];			String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.changevariable.description", curr.getName()); //$NON-NLS-1$			proposals.add(new ReplaceCorrectionProposal(label, problemPos.getCompilationUnit(), node.getStartPosition(), node.getLength(), curr.getName(), 3));		}		// add type proposals		if ((similarNodeKind & SimilarElementsRequestor.ALL_TYPES) != 0) {			ProblemPosition newProblemPos= createProblemPosition(node, problemPos);			addSimilarTypeProposals(elements, node.getIdentifier(), newProblemPos, proposals);			addNewTypeProposals(node.getIdentifier(), newProblemPos, SimilarElementsRequestor.REF_TYPES, proposals);		}				// new variables		BodyDeclaration bodyDeclaration= ASTResolving.findParentBodyDeclaration(node);		if (bodyDeclaration != null) {			String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createfield.description", node.getIdentifier()); //$NON-NLS-1$			proposals.add(new NewVariableCompletionProposal(label, cu, NewVariableCompletionProposal.FIELD, node, 2));		}				int type= bodyDeclaration.getNodeType();		if (type == ASTNode.METHOD_DECLARATION) {			String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createparameter.description", node.getIdentifier()); //$NON-NLS-1$			proposals.add(new NewVariableCompletionProposal(label, cu, NewVariableCompletionProposal.PARAM, node, 1));		}		if (type == ASTNode.METHOD_DECLARATION || type == ASTNode.INITIALIZER) {			String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createlocal.description", node.getIdentifier()); //$NON-NLS-1$			proposals.add(new NewVariableCompletionProposal(label, cu, NewVariableCompletionProposal.LOCAL, node, 1));		}			}