Author: scabanovich
Date: 2010-06-09 05:20:55 -0400 (Wed, 09 Jun 2010)
New Revision: 22695
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
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
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
Log:
https://jira.jboss.org/browse/JBIDE-6436
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2010-06-09
08:09:19 UTC (rev 22694)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2010-06-09
09:20:55 UTC (rev 22695)
@@ -13,6 +13,9 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.ICDIElement;
/**
@@ -28,6 +31,15 @@
return parent != null ? parent.getCDIProject() : null;
}
+ protected ParametedType getObjectType(IMember context) {
+ try {
+ return getCDIProject().getNature().getTypeFactory().getParametedType(context,
"QObject;");
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ return null;
+ }
+ }
+
public void setParent(CDIElement parent) {
this.parent = parent;
}
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-09
08:09:19 UTC (rev 22694)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-06-09
09:20:55 UTC (rev 22695)
@@ -786,8 +786,10 @@
bean.setParent(this);
bean.setDefinition(typeDefinition);
- beans.add(bean);
- newClassBeans.put(typeDefinition.getType(), bean);
+ if(typeDefinition.hasBeanConstructor()) {
+ beans.add(bean);
+ newClassBeans.put(typeDefinition.getType(), bean);
+ }
Set<IProducer> ps = bean.getProducers();
for (IProducer producer: ps) {
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-09
08:09:19 UTC (rev 22694)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2010-06-09
09:20:55 UTC (rev 22695)
@@ -262,6 +262,10 @@
if(d != null) {
Set<ITypeDeclaration> ts = getRestrictedTypeDeclaratios();
result.addAll(ts);
+ ParametedType object = getObjectType(getBeanClass());
+ if(object != null) {
+ result.add(object);
+ }
return result;
}
return getAllTypes();
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-09
08:09:19 UTC (rev 22694)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2010-06-09
09:20:55 UTC (rev 22695)
@@ -67,6 +67,10 @@
if(d != null) {
Set<ITypeDeclaration> ts = getRestrictedTypeDeclaratios();
result.addAll(ts);
+ ParametedType object = getObjectType(getBeanClass());
+ if(object != null) {
+ result.add(object);
+ }
return result;
}
return getAllTypes();
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-09
08:09:19 UTC (rev 22694)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2010-06-09
09:20:55 UTC (rev 22695)
@@ -89,6 +89,10 @@
if(d != null) {
Set<ITypeDeclaration> ts = getRestrictedTypeDeclaratios();
result.addAll(ts);
+ ParametedType object = getObjectType(getBeanClass());
+ if(object != null) {
+ result.add(object);
+ }
return result;
}
return getAllTypes();
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-06-09
08:09:19 UTC (rev 22694)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-06-09
09:20:55 UTC (rev 22695)
@@ -31,6 +31,7 @@
boolean isAbstract;
List<FieldDefinition> fields = new ArrayList<FieldDefinition>();
List<MethodDefinition> methods = new ArrayList<MethodDefinition>();
+ boolean hasBeanConstructor = false;
public TypeDefinition() {
}
@@ -53,6 +54,7 @@
}
}
IMethod[] ms = getType().getMethods();
+ boolean hasConstructor = false;
for (int i = 0; i < ms.length; i++) {
MethodDefinition m = new MethodDefinition();
m.setTypeDefinition(this);
@@ -60,7 +62,16 @@
if(m.isCDIAnnotated() || (ms[i].isConstructor() &&
ms[i].getNumberOfParameters()==0)) {
methods.add(m);
}
+ if(ms[i].isConstructor()) {
+ hasConstructor = true;
+ if(ms[i].getNumberOfParameters() == 0 || m.getInjectAnnotation() != null) {
+ hasBeanConstructor = true;
+ }
+ }
}
+ if(!hasConstructor) {
+ hasBeanConstructor = true;
+ }
}
public ParametedType getSuperType() {
@@ -79,6 +90,10 @@
return isAbstract;
}
+ public boolean hasBeanConstructor() {
+ return hasBeanConstructor;
+ }
+
public AnnotationDeclaration getDecoratorAnnotation() {
return annotationsByType.get(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
}