Author: scabanovich
Date: 2010-06-11 07:41:35 -0400 (Fri, 11 Jun 2010)
New Revision: 22766
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/ClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
Log:
https://jira.jboss.org/browse/JBIDE-6447
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-06-11
10:53:05 UTC (rev 22765)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-06-11
11:41:35 UTC (rev 22766)
@@ -188,10 +188,11 @@
while(it.hasNext()) {
IBean b = it.next();
if(b.isAlternative()) {
- //TODO check that alternative is enabled in beans.xml
- // otherwise it should be excluded from result
- containsAlternatives = true;
- break;
+ if(b.isSelectedAlternative()) {
+ containsAlternatives = true;
+ } else {
+ it.remove();
+ }
}
}
@@ -492,6 +493,14 @@
return result;
}
+ public boolean isTypeAlternative(String qualifiedName) {
+ return beansXMLData.getTypeAlternativeTypes().contains(qualifiedName);
+ }
+
+ public boolean isStereotypeAlternative(String qualifiedName) {
+ return beansXMLData.getStereotypeAlternativeTypes().contains(qualifiedName);
+ }
+
public Set<IType> getQualifierTypes() {
Set<IType> result = new HashSet<IType>();
List<AnnotationDefinition> ds = n.getDefinitions().getAllAnnotations();
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 2010-06-11
10:53:05 UTC (rev 22765)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2010-06-11
11:41:35 UTC (rev 22766)
@@ -457,7 +457,15 @@
* @see org.jboss.tools.cdi.core.IBean#isSelectedAlternative()
*/
public boolean isSelectedAlternative() {
- // TODO
- return isAlternative();
+ if(getDefinition().getAlternativeAnnotation() != null &&
getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
+ return true;
+ }
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative() &&
+ getCDIProject().isStereotypeAlternative(s.getSourceType().getFullyQualifiedName()) )
return true;
+ }
+ return false;
}
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2010-06-11
10:53:05 UTC (rev 22765)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2010-06-11
11:41:35 UTC (rev 22766)
@@ -185,7 +185,16 @@
* @see org.jboss.tools.cdi.core.IBean#isSelectedAlternative()
*/
public boolean isSelectedAlternative() {
- // TODO
- return isAlternative();
+ if(getDefinition().getAlternativeAnnotation() != null &&
getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
+ return true;
+ }
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative() &&
+ getCDIProject().isStereotypeAlternative(s.getSourceType().getFullyQualifiedName()) )
return true;
+ }
+ return false;
}
+
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2010-06-11
10:53:05 UTC (rev 22765)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2010-06-11
11:41:35 UTC (rev 22766)
@@ -237,7 +237,15 @@
* @see org.jboss.tools.cdi.core.IBean#isSelectedAlternative()
*/
public boolean isSelectedAlternative() {
- // TODO
- return isAlternative();
+ if(getDefinition().getAlternativeAnnotation() != null &&
getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
+ return true;
+ }
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ for (IStereotypeDeclaration d: ds) {
+ IStereotype s = d.getStereotype();
+ if(s != null && s.isAlternative() &&
+ getCDIProject().isStereotypeAlternative(s.getSourceType().getFullyQualifiedName()) )
return true;
+ }
+ return false;
}
}
\ No newline at end of file