Author: dazarov
Date: 2010-02-10 12:59:29 -0500 (Wed, 10 Feb 2010)
New Revision: 20224
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3125
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/META-INF/MANIFEST.MF 2010-02-10
17:51:34 UTC (rev 20223)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/META-INF/MANIFEST.MF 2010-02-10
17:59:29 UTC (rev 20224)
@@ -18,6 +18,7 @@
org.eclipse.ui.ide;bundle-version="3.5.0",
org.jboss.tools.cdi.core;bundle-version="1.0.0",
org.jboss.tools.common;bundle-version="2.0.0",
- org.jboss.tools.common.el.core;bundle-version="2.0.0"
+ org.jboss.tools.common.el.core;bundle-version="2.0.0",
+ org.jboss.tools.common.model;bundle-version="2.0.0"
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2010-02-10
17:51:34 UTC (rev 20223)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2010-02-10
17:59:29 UTC (rev 20224)
@@ -19,6 +19,7 @@
import org.eclipse.jdt.core.ICodeAssist;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
@@ -33,6 +34,7 @@
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.text.ext.CDIExtensionsPlugin;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
public class InjectedPointHyperlinkDetector extends AbstractHyperlinkDetector{
@@ -92,11 +94,10 @@
}
}
- if (element instanceof IAnnotatable) {
+ if (element instanceof IAnnotatable && element instanceof IMember) {
IAnnotatable annotatable = (IAnnotatable)element;
- IAnnotation annotation =
annotatable.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
- if (annotation == null)
+ if(!findAnnotation(annotatable, ((IMember)element).getDeclaringType()))
continue;
hyperlinks.add(new InjectedPointListHyperlink(file, textViewer, wordRegion, element,
document));
@@ -112,6 +113,18 @@
return null;
}
-
+ private boolean findAnnotation(IAnnotatable annotatable, IType type){
+ try{
+ IAnnotation[] annotations = annotatable.getAnnotations();
+ for(IAnnotation annotation : annotations){
+ if(annotation != null && annotation.getElementName() != null &&
CDIConstants.INJECT_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(type,
annotation.getElementName())))
+ return true;
+ }
+ }catch (JavaModelException jme) {
+ CDIExtensionsPlugin.log(jme);
+ }
+ return false;
+
+ }
}