Author: scabanovich
Date: 2010-03-02 10:51:50 -0500 (Tue, 02 Mar 2010)
New Revision: 20568
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5972
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2010-03-02
15:34:47 UTC (rev 20567)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2010-03-02
15:51:50 UTC (rev 20568)
@@ -94,7 +94,7 @@
*
* @return the qualifiers
*/
- Set<IType> getQualifiers();
+ Set<IQualifier> getQualifiers();
/**
* Obtains the stereotype declarations of the bean class or producer method
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-03-02
15:34:47 UTC (rev 20567)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-03-02
15:51:50 UTC (rev 20568)
@@ -172,7 +172,7 @@
* @return interceptor binding model element for fully qualified name of
* interceptor binding annotation type
*/
- InterceptorBindingElement getInterceptorBinding(String qualifiedName);
+ IInterceptorBinding getInterceptorBinding(String qualifiedName);
/**
* Returns qualifier model element for fully qualified name
@@ -181,7 +181,7 @@
* @return Returns qualifier model element for fully qualified name
* of qualifier annotation type
*/
- QualifierElement getQualifier(String qualifiedName);
+ IQualifier getQualifier(String qualifiedName);
/**
* Returns scope model element for fully qualified name of scope annotation
@@ -191,7 +191,7 @@
* @return the scope model element for fully qualified name of scope
* annotation type
*/
- ScopeElement getScope(String qualifiedName);
+ IScope getScope(String qualifiedName);
/**
* Returns the set of observers for an event which is injected by given
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2010-03-02
15:34:47 UTC (rev 20567)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2010-03-02
15:51:50 UTC (rev 20568)
@@ -23,9 +23,14 @@
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.IScopeDeclaration;
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
@@ -100,9 +105,31 @@
return result;
}
- public Set<IType> getQualifiers() {
- Set<IType> result = new HashSet<IType>();
- // TODO
+ public Set<IQualifier> getQualifiers() {
+ IQualifier any = getCDIProject().getQualifier(CDIConstants.ANY_QUALIFIER_TYPE_NAME);
+ IQualifier def =
getCDIProject().getQualifier(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME);
+ IQualifier name =
getCDIProject().getQualifier(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
+
+ Set<IQualifier> result = new HashSet<IQualifier>();
+ Set<IAnnotationDeclaration> ds = getQualifierDeclarations();
+ for (IAnnotationDeclaration d: ds) {
+ if(d instanceof IQualifierDeclaration) {
+ IQualifier q = ((IQualifierDeclaration)d).getQualifier();
+ if(q != null) result.add(q);
+ }
+ }
+ if(this instanceof IInjectionPoint) {
+ if(def != null && result.isEmpty()) {
+ result.add(def);
+ }
+ } else if(this instanceof IBean) {
+ if(def != null) {
+ if(result.isEmpty() || (name != null && result.size() == 1 &&
result.contains(name))) {
+ result.add(def);
+ }
+ }
+ if(any != null) result.add(any);
+ }
return result;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java 2010-03-02
15:34:47 UTC (rev 20567)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java 2010-03-02
15:51:50 UTC (rev 20568)
@@ -65,4 +65,10 @@
public IAnnotationDeclaration getAnnotationDeclaration(String typeName) {
return definition.getAnnotation(typeName);
}
+
+ public String toString() {
+ String type = getSourceType() == null ? "" :
getSourceType().getFullyQualifiedName();
+ return super.toString() + " type=" + type;
+ }
+
}
\ No newline at end of file