Author: scabanovich
Date: 2010-05-12 09:02:43 -0400 (Wed, 12 May 2010)
New Revision: 22032
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6252
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-05-12
09:31:55 UTC (rev 22031)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-05-12
13:02:43 UTC (rev 22032)
@@ -41,6 +41,7 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IObserverMethod;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IParameter;
import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
@@ -561,8 +562,44 @@
}
public Set<IBeanMethod> resolveDisposers(IProducerMethod producer) {
- // TODO
- return new HashSet<IBeanMethod>();
+ Set<IBeanMethod> result = new HashSet<IBeanMethod>();
+ IClassBean cb = producer.getClassBean();
+ if(cb == null) return result;
+
+ Set<IParametedType> types = producer.getLegalTypes();
+ Set<IQualifierDeclaration> qs = producer.getQualifierDeclarations(true);
+
+ Set<IBeanMethod> ds = cb.getDisposers();
+ for (IBeanMethod m: ds) {
+ List<IParameter> ps = m.getParameters();
+ IParameter match = null;
+ for (IParameter p: ps) {
+ if(!p.isAnnotationPresent(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME)) continue;
+ IParametedType type = p.getType();
+ if(!containsType(types, type)) continue;
+ Set<IType> qts = new HashSet<IType>();
+ Set<String> ts = ((Parameter)p).getAnnotationTypes();
+ for (String t: ts) {
+ QualifierElement q = getQualifier(t);
+ if(q != null && q.getSourceType() != null) {
+ qts.add(q.getSourceType());
+ }
+ }
+ IType[] qtsa = qts.toArray(new IType[0]);
+ try {
+ if(areMatchingQualifiers(qs, qtsa)) {
+ match = p;
+ break;
+ }
+ } catch (CoreException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ if(match != null) {
+ result.add(m);
+ }
+ }
+ return result;
}
public CDIProject getCDIProject() {