Author: scabanovich
Date: 2012-04-27 19:20:52 -0400 (Fri, 27 Apr 2012)
New Revision: 40598
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/ClassBean.java
Log:
JBIDE-11540
https://issues.jboss.org/browse/JBIDE-11540
Collecting bean stereotypes is fixed.
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 2012-04-27
23:19:59 UTC (rev 40597)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2012-04-27
23:20:52 UTC (rev 40598)
@@ -145,42 +145,55 @@
}
public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
- return getStereotypeDeclarations(true);
+ return getStereotypeDeclarations(false);
}
public Set<IStereotypeDeclaration> getStereotypeDeclarations(boolean
includeInherited) {
Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
+ Set<IStereotype> ss = new HashSet<IStereotype>();
for (IAnnotationDeclaration d: definition.getAnnotations()) {
if(d instanceof IStereotypeDeclaration) {
- if(d instanceof IStereotypeDeclaration) {
- result.add((IStereotypeDeclaration)d);
+ IStereotypeDeclaration sd = (IStereotypeDeclaration)d;
+ result.add(sd);
+ if(sd.getStereotype() != null) ss.add(sd.getStereotype());
+ }
+ }
+ Set<IStereotypeDeclaration> delta1 = result;
+ Set<IStereotypeDeclaration> delta2 = new
HashSet<IStereotypeDeclaration>();
+ while(!delta1.isEmpty()) {
+ for (IStereotypeDeclaration d: delta1) {
+ IStereotype s = d.getStereotype();
+ if(s == null) continue;
+ Set<IStereotypeDeclaration> ds = s.getStereotypeDeclarations();
+ for (IStereotypeDeclaration d1: ds) {
+ if(d1.getStereotype() != null) {
+ if(!result.contains(d1) && !delta2.contains(d1)) delta2.add(d1);
+ }
}
}
+ if(delta2.isEmpty()) break;
+ for (IStereotypeDeclaration d: delta2) {
+ result.add(d);
+ if(d.getStereotype() != null) ss.add(d.getStereotype());
+ }
+ delta1 = delta2;
+ delta2 = new HashSet<IStereotypeDeclaration>();
}
if(includeInherited) {
- Set<IStereotypeDeclaration> delta1 = result;
- Set<IStereotypeDeclaration> delta2 = new
HashSet<IStereotypeDeclaration>();
- while(!delta1.isEmpty()) {
- for (IStereotypeDeclaration d: delta1) {
- IStereotype s = d.getStereotype();
- if(s == null) continue;
- Set<IStereotypeDeclaration> ds = s.getStereotypeDeclarations();
- for (IStereotypeDeclaration d1: ds) {
- IStereotype s1 = d1.getStereotype();
- if(s1 != null/* && s1.getInheritedDeclaration() != null*/) {
- if(!result.contains(d1) && !delta2.contains(d1)) delta2.add(d1);
- }
- }
+ Set<IStereotypeDeclaration> ds = getInheritedStereotypDeclarations();
+ for (IStereotypeDeclaration d : ds) {
+ if (d.getStereotype() != null && !ss.contains(d.getStereotype())) {
+ result.add(d);
}
- if(delta2.isEmpty()) break;
- result.addAll(delta2);
- delta1 = delta2;
- delta2 = new HashSet<IStereotypeDeclaration>();
}
}
return result;
}
+ public Set<IStereotypeDeclaration> getInheritedStereotypDeclarations() {
+ return Collections.emptySet();
+ }
+
public Set<IQualifierDeclaration> getQualifierDeclarations() {
return getQualifierDeclarations(false);
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2012-04-27
23:19:59 UTC (rev 40597)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2012-04-27
23:20:52 UTC (rev 40598)
@@ -431,7 +431,7 @@
if(getCDIProject().isClassAlternativeActivated(getDefinition().getQualifiedName())) {
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations(true);
for (IStereotypeDeclaration d: ds) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
!getCDIProject().getAlternatives(s.getSourceType().getFullyQualifiedName()).isEmpty()) {
@@ -569,7 +569,7 @@
if(getDefinition().getAlternativeAnnotation() != null &&
getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations(true);
for (IStereotypeDeclaration d: ds) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&