Author: scabanovich
Date: 2007-07-12 11:01:20 -0400 (Thu, 12 Jul 2007)
New Revision: 2404
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
Log:
EXIN-217 bijected fields processed in java scanner
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-12
14:43:41 UTC (rev 2403)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-12
15:01:20 UTC (rev 2404)
@@ -27,5 +27,12 @@
* @return
*/
public boolean isOfType(BijectedAttributeType type);
+
+ /**
+ * Though this interface extends ISeamContextVariable, not all
+ * types are allowed to be context variables
+ * @return
+ */
+ public boolean isContextVariable();
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-12
14:43:41 UTC (rev 2403)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-12
15:01:20 UTC (rev 2404)
@@ -30,6 +30,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamContextVariable;
@@ -284,7 +285,10 @@
if(loaded instanceof ISeamJavaComponentDeclaration) {
SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)loaded;
javaDeclarations.put(jd.getClassName(), jd);
- allVariables.addAll(jd.getBijectedAttributes());
+ Set<IBijectedAttribute> as = jd.getBijectedAttributes();
+ for (IBijectedAttribute a : as) {
+ if(a.isContextVariable()) allVariables.add(a);
+ }
allVariables.addAll(jd.getRoles());
Set<ISeamComponent> cs = getComponentsByClass(jd.getClassName());
for (ISeamComponent ci: cs) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-12
14:43:41 UTC (rev 2403)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-12
15:01:20 UTC (rev 2404)
@@ -163,6 +163,41 @@
att.setSourceMember(findMethod(m));
}
+
+ for (AnnotatedASTNode<FieldDeclaration> n: annotatedFields) {
+ Map<BijectedAttributeType, Annotation> as = new
HashMap<BijectedAttributeType, Annotation>();
+ List<BijectedAttributeType> types = new
ArrayList<BijectedAttributeType>();
+ Annotation main = null;
+ for (int i = 0; i < BijectedAttributeType.values().length; i++) {
+ Annotation a = findAnnotation(n,
BijectedAttributeType.values()[i].getAnnotationType());
+ if(a != null) {
+ as.put(BijectedAttributeType.values()[i], a);
+ if(main == null) main = a;
+ types.add(BijectedAttributeType.values()[i]);
+ }
+ }
+ if(as.size() == 0) continue;
+
+ FieldDeclaration m = n.getNode();
+
+ BijectedAttribute att = new BijectedAttribute();
+ component.addBijectedAttribute(att);
+
+ att.setTypes(types.toArray(new BijectedAttributeType[0]));
+
+ ValueInfo name = ValueInfo.getValueInfo(main, null);
+ if(name == null) {
+ name = new ValueInfo();
+ name.value = getFieldName(m);
+ }
+
+ att.setName(name.getValue());
+
+ ValueInfo scope = ValueInfo.getValueInfo(main, "scope");
+ if(scope != null) att.setScopeAsString(scope.getValue());
+
+ att.setSourceMember(findField(m));
+ }
}
void processComponentMethods() {
@@ -272,7 +307,7 @@
}
return null;
}
-
+
/**
* Returns name of first field
* @param node
Show replies by date