Author: scabanovich
Date: 2011-08-17 20:26:10 -0400 (Wed, 17 Aug 2011)
New Revision: 34028
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java
Log:
JBIDE-6517
https://issues.jboss.org/browse/JBIDE-6517
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java 2011-08-17
23:54:09 UTC (rev 34027)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java 2011-08-18
00:26:10 UTC (rev 34028)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
@@ -129,7 +130,7 @@
if(f != null && f.exists()) {
value = f.getDeclaringType().getFullyQualifiedName() + "." + lastToken;
} else {
- String v = getFullName(is, lastToken);
+ String v = getFullName(type, is, lastToken);
if(v != null) {
value = v;
}
@@ -153,12 +154,23 @@
return value;
}
- private String getFullName(IImportDeclaration[] is, String name) {
+ private String getFullName(IType type, IImportDeclaration[] is, String name) throws
CoreException {
for (IImportDeclaration d: is) {
String n = d.getElementName();
if(n.equals(name) || n.endsWith("." + name)) {
return n;
}
+ if(Flags.isStatic(d.getFlags()) && n.endsWith(".*")) {
+ String typename = n.substring(0, n.length() - 2);
+ IType t = EclipseJavaUtil.findType(type.getJavaProject(), typename);
+ if(t != null && t.exists()) {
+ IField f = EclipseJavaUtil.findField(t, name);
+ if(f != null) {
+ return f.getDeclaringType().getFullyQualifiedName() + "." + name;
+ }
+ }
+
+ }
}
return null;
}