String typeName= cu.getBuffer().getText(problemPos.getOffset(), problemPos.getLength()); int bracketIndex= typeName.indexOf('['); if (bracketIndex != -1) { typeName= typeName.substring(0, bracketIndex);
Name node= null; if (selectedNode instanceof SimpleType) { node= ((SimpleType) selectedNode).getName(); } else if (selectedNode instanceof ArrayType) { Type elementType= ((ArrayType) selectedNode).getElementType(); if (elementType.isSimpleType()) { node= ((SimpleType) elementType).getName(); } } else if (selectedNode instanceof Name) { node= (Name) selectedNode; } else { return;
	public static void getTypeProposals(ProblemPosition problemPos, int kind, ArrayList proposals) throws CoreException {		ICompilationUnit cu= problemPos.getCompilationUnit();				CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);		ASTNode selectedNode= ASTResolving.findSelectedNode(astRoot, problemPos.getOffset(), problemPos.getLength());				// corrections		String typeName= cu.getBuffer().getText(problemPos.getOffset(), problemPos.getLength());		int bracketIndex= typeName.indexOf('[');		if (bracketIndex != -1) {			typeName= typeName.substring(0, bracketIndex);		}				SimilarElement[] elements= SimilarElementsRequestor.findSimilarElement(cu, problemPos.getOffset(), typeName, kind);		addSimilarTypeProposals(elements, typeName, problemPos, proposals);				// add type		addNewTypeProposals(typeName, problemPos, kind, proposals);	}