Author: scabanovich
Date: 2011-05-24 12:33:55 -0400 (Tue, 24 May 2011)
New Revision: 31449
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/.settings/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/.settings/org.eclipse.jdt.core.prefs
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderUnwrapsExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/CDISeamSolderGenericBeanExtension.java
Log:
JBIDE-8674
https://issues.jboss.org/browse/JBIDE-8674
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/.settings/org.eclipse.jdt.core.prefs 2011-05-24
16:33:55 UTC (rev 31449)
@@ -0,0 +1,8 @@
+#Wed May 18 16:43:06 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java 2011-05-24
16:28:10 UTC (rev 31448)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderCoreExtension.java 2011-05-24
16:33:55 UTC (rev 31449)
@@ -233,7 +233,9 @@
private String resolvePackageName(IAnnotationDeclaration fullyQualified,
IAnnotationDeclaration fullyQualifiedOnPackage, AbstractTypeDefinition t,
PackageDefinition p) {
String contextClass = null;
IAnnotationDeclaration a = fullyQualified != null ? fullyQualified :
fullyQualifiedOnPackage;
- contextClass = getStringValue(a);
+ if(a != null) {
+ contextClass = getStringValue(a);
+ }
if(contextClass == null) {
contextClass = t == null ? "" : t.getQualifiedName();
} else if(fullyQualified != null && t != null) {
@@ -274,7 +276,6 @@
}
private String getStringValue(IAnnotationDeclaration a) {
- if(a == null) return null;
Object o = a.getMemberValue(null);
return o == null ? null : o.toString();
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2011-05-24
16:28:10 UTC (rev 31448)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2011-05-24
16:33:55 UTC (rev 31449)
@@ -80,17 +80,19 @@
}
IJavaAnnotation createFakeTypedAnnotation(AbstractMemberDefinition def,
IRootDefinitionContext context) {
+ IJavaAnnotation result = null;
IAnnotationDeclaration a =
def.getAnnotation(CDISeamSolderConstants.DEFAULT_BEAN_ANNOTATION_TYPE_NAME);
- if(a == null) return null;
- Object n = a.getMemberValue(null);
- String defaultType = null;
- if(n != null && n.toString().length() > 0) {
- defaultType = n.toString();
- IType typedAnnotation =
context.getProject().getType(CDIConstants.TYPED_ANNOTATION_TYPE_NAME);
- return (typedAnnotation == null) ? null
- : new AnnotationLiteral(def.getResource(), a.getStartPosition(), a.getLength(),
defaultType, IMemberValuePair.K_CLASS, typedAnnotation);
+ if(a != null) {
+ Object n = a.getMemberValue(null);
+ if(n != null && n.toString().length() > 0) {
+ String defaultType = n.toString();
+ IType typedAnnotation =
context.getProject().getType(CDIConstants.TYPED_ANNOTATION_TYPE_NAME);
+ if (typedAnnotation != null) {
+ result = new AnnotationLiteral(def.getResource(), a.getStartPosition(),
a.getLength(), defaultType, IMemberValuePair.K_CLASS, typedAnnotation);
+ }
+ }
}
- return null;
+ return result;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderUnwrapsExtension.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderUnwrapsExtension.java 2011-05-24
16:28:10 UTC (rev 31448)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderUnwrapsExtension.java 2011-05-24
16:33:55 UTC (rev 31449)
@@ -45,12 +45,24 @@
}
+ /**
+ * Returns new annotation object with Produces type if definition is annotated with
Unwraps
+ * and Produces type is available in class path. Returns null otherwise.
+ *
+ * @param def
+ * @param context
+ * @return new annotation object with Produces type or null
+ */
IJavaAnnotation createFakeProducesAnnotation(AbstractMemberDefinition def,
IRootDefinitionContext context) {
+ IJavaAnnotation result = null;
IAnnotationDeclaration a =
def.getAnnotation(CDISeamSolderConstants.UNWRAPS_ANNOTATION_TYPE_NAME);
- if(a == null) return null;
- IType producesAnnotation =
context.getProject().getType(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
- return (producesAnnotation == null) ? null
- : new AnnotationLiteral(def.getResource(), a.getStartPosition(), a.getLength(), null,
IMemberValuePair.K_UNKNOWN, producesAnnotation);
+ if(a != null) {
+ IType producesAnnotation =
context.getProject().getType(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
+ if (producesAnnotation != null) {
+ result = new AnnotationLiteral(def.getResource(), a.getStartPosition(),
a.getLength(), null, IMemberValuePair.K_UNKNOWN, producesAnnotation);
+ }
+ }
+ return result;
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/CDISeamSolderGenericBeanExtension.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/CDISeamSolderGenericBeanExtension.java 2011-05-24
16:28:10 UTC (rev 31448)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/CDISeamSolderGenericBeanExtension.java 2011-05-24
16:33:55 UTC (rev 31449)
@@ -182,6 +182,7 @@
if(p != null && p.getType() != null) {
GenericConfiguration c =
((GenericBeanDefinitionContext)this.context.getWorkingCopy()).getGenericConfiguration(p.getType().getFullyQualifiedName());
c.getGenericConfigurationBeans().add(typeDefinition);
+ addToDependencies(c, typeDefinition, context);
}
} catch (JavaModelException e) {
CDISeamSolderCorePlugin.getDefault().logError(e);
@@ -189,28 +190,28 @@
}
}
} else {
- addGenericProducerBean(typeDefinition);
+ addGenericProducerBean(typeDefinition, context);
for (MethodDefinition m: typeDefinition.getMethods()) {
if(m.isAnnotationPresent(PRODUCES_ANNOTATION_TYPE_NAME)) {
- addGenericProducerBean(m);
+ addGenericProducerBean(m, context);
}
}
for (FieldDefinition f: typeDefinition.getFields()) {
if(f.isAnnotationPresent(PRODUCES_ANNOTATION_TYPE_NAME)) {
- addGenericProducerBean(f);
+ addGenericProducerBean(f, context);
}
}
}
}
- private void addGenericProducerBean(AbstractMemberDefinition def) {
+ private void addGenericProducerBean(AbstractMemberDefinition def, IRootDefinitionContext
context) {
IAnnotationDeclaration d = findAnnotationAnnotatedWithGenericType(def);
if(d != null) {
- addGenericProducerBean(def, d.getTypeName());
+ addGenericProducerBean(def, d.getTypeName(), context);
}
}
- private void addGenericProducerBean(AbstractMemberDefinition def, String genericType) {
+ private void addGenericProducerBean(AbstractMemberDefinition def, String genericType,
IRootDefinitionContext context) {
GenericConfiguration c =
((GenericBeanDefinitionContext)this.context.getWorkingCopy()).getGenericConfiguration(genericType);
List<IAnnotationDeclaration> list = new
ArrayList<IAnnotationDeclaration>();
@@ -221,14 +222,17 @@
}
}
c.getGenericProducerBeans().put(def, list);
+ addToDependencies(c, def, context);
+ }
+ private void addToDependencies(GenericConfiguration c, AbstractMemberDefinition def,
IRootDefinitionContext context) {
IResource r = def.getResource();
if(r != null && r.exists() &&
!c.getInvolvedTypes().contains(r.getFullPath())) {
IPath newPath = r.getFullPath();
Set<IPath> ps = c.getInvolvedTypes();
for (IPath p: ps) {
- context.getRootContext().addDependency(p, newPath);
- context.getRootContext().addDependency(newPath, p);
+ context.addDependency(p, newPath);
+ context.addDependency(newPath, p);
}
ps.add(newPath);
}