IVariableBinding[] fields= accessorClassBinding.getDeclaredFields(); for (int i= 0; i < fields.length; i++) { if (isBundleField(fields[i])) { VariableDeclarationFragment node= (VariableDeclarationFragment) astRoot.findDeclaringNode(fields[i].getKey()); if (node != null) { Expression initializer= node.getInitializer(); if (initializer instanceof StringLiteral) { return ((StringLiteral) initializer).getLiteralValue(); } else if (initializer instanceof MethodInvocation) { MethodInvocation methInvocation= (MethodInvocation) initializer; Expression exp= methInvocation.getExpression(); if ((exp != null) && (exp instanceof TypeLiteral)) { SimpleType simple= (SimpleType) ((TypeLiteral) exp).getType(); ITypeBinding typeBinding= simple.resolveBinding(); if (typeBinding != null) { return Bindings.getRawQualifiedName(typeBinding); }
final Map resultCollector= new HashMap(5); final Object RESULT_KEY= new Object(); final Object FIELD_KEY= new Object();  astRoot.accept(new ASTVisitor() {  public boolean visit(MethodInvocation node) { IMethodBinding method= node.resolveMethodBinding(); if (method == null) return true;  String name= method.getDeclaringClass().getQualifiedName(); if (!("java.util.ResourceBundle".equals(name) && "getBundle".equals(method.getName()) && node.arguments().size() > 0)) return true;  Expression argument= (Expression)node.arguments().get(0);  if (argument instanceof StringLiteral) { resultCollector.put(RESULT_KEY, ((StringLiteral)argument).getLiteralValue()); return false; } if (argument instanceof Name) { resultCollector.put(FIELD_KEY, ((Name)argument).resolveBinding()); return false; }  if (argument instanceof MethodInvocation) { MethodInvocation methInvocation= (MethodInvocation)argument; Expression exp= methInvocation.getExpression(); if ((exp != null) && (exp instanceof TypeLiteral)) { SimpleType simple= (SimpleType)((TypeLiteral) exp).getType(); ITypeBinding typeBinding= simple.resolveBinding(); if (typeBinding != null) { resultCollector.put(RESULT_KEY, typeBinding.getQualifiedName()); return false;
	public static String getResourceBundleName(IJavaProject javaProject, ITypeBinding accessorClassBinding) throws JavaModelException {		IJavaElement je= accessorClassBinding.getJavaElement();		if (je == null)			return null;				IOpenable openable= je.getOpenable();		IJavaElement container= null;		if (openable instanceof ICompilationUnit)			container= (ICompilationUnit)openable;		else if (openable instanceof IClassFile)			container= (IClassFile)openable;		else			Assert.isLegal(false);				CompilationUnit astRoot= JavaPlugin.getDefault().getASTProvider().getAST(container, ASTProvider.WAIT_YES, null);				IVariableBinding[] fields= accessorClassBinding.getDeclaredFields();		for (int i= 0; i < fields.length; i++) {			if (isBundleField(fields[i])) {				VariableDeclarationFragment node= (VariableDeclarationFragment) astRoot.findDeclaringNode(fields[i].getKey());				if (node != null) {					Expression initializer= node.getInitializer();					if (initializer instanceof StringLiteral) {						return ((StringLiteral) initializer).getLiteralValue();					} else if (initializer instanceof MethodInvocation) {						MethodInvocation methInvocation= (MethodInvocation) initializer;						Expression exp= methInvocation.getExpression();						if ((exp != null) && (exp instanceof TypeLiteral)) {							SimpleType simple= (SimpleType) ((TypeLiteral) exp).getType();							ITypeBinding typeBinding= simple.resolveBinding();							if (typeBinding != null) {								return Bindings.getRawQualifiedName(typeBinding);							}						}					}				}			}		}		return null;	}