Author: scabanovich
Date: 2007-07-06 08:07:13 -0400 (Fri, 06 Jul 2007)
New Revision: 2339
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
Log:
EXIN-217 Auto-create property added to ISeamAnnotatedFactory.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java 2007-07-06
11:46:13 UTC (rev 2338)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamAnnotatedFactory.java 2007-07-06
12:07:13 UTC (rev 2339)
@@ -15,5 +15,7 @@
* @author Alexey Kazakov
*/
public interface ISeamAnnotatedFactory extends ISeamFactory, ISeamJavaSourceReference {
+
+ boolean isAutoCreate();
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-06
11:46:13 UTC (rev 2338)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-06
12:07:13 UTC (rev 2339)
@@ -10,18 +10,22 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.List;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
-import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
*/
public class SeamAnnotatedFactory extends SeamFactory implements ISeamAnnotatedFactory {
IMethod javaSource = null;
+ boolean autoCreate = false;
public IMethod getSourceMethod() {
return javaSource;
@@ -35,6 +39,14 @@
return javaSource;
}
+ public boolean isAutoCreate() {
+ return autoCreate;
+ }
+
+ public void setAutoCreate(boolean autoCreate) {
+ this.autoCreate = autoCreate;
+ }
+
public int getLength() {
if(javaSource == null) return 0;
try {
@@ -61,4 +73,16 @@
}
}
+ public List<Change> merge(SeamFactory f) {
+ List<Change> changes = super.merge(f);
+ SeamAnnotatedFactory af = (SeamAnnotatedFactory)f;
+
+ if(autoCreate != af.autoCreate) {
+ changes = Change.addChange(changes, new Change(this,
ISeamXmlComponentDeclaration.AUTO_CREATE, autoCreate, af.autoCreate));
+ autoCreate = af.autoCreate;
+ }
+
+ return changes;
+ }
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06
11:46:13 UTC (rev 2338)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06
12:07:13 UTC (rev 2339)
@@ -6,5 +6,13 @@
public static String NAME_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Name";
public static String SCOPE_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Scope";
public static String INSTALL_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Install";
+
+ public static String IN_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX + "In";
+ public static String OUT_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Out";
+ public static String CREATE_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Create";
+ public static String DESTROY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Destroy";
+
+ public static String FACTORY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Factory";
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06
11:46:13 UTC (rev 2338)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06
12:07:13 UTC (rev 2339)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
@@ -53,7 +54,7 @@
component.setSourcePath(path);
component.setId(type);
component.setClassName(type.getFullyQualifiedName());
- process(cls, component);
+ process(cls, component, ds);
ds.getComponents().add(component);
return ds;
@@ -89,7 +90,7 @@
return map;
}
- private void process(Class<?> cls, SeamJavaComponentDeclaration component) {
+ private void process(Class<?> cls, SeamJavaComponentDeclaration component,
LoadedDeclarations ds) {
Map<String, Annotation> map = getSeamAnnotations(cls.getAnnotations());
if(map != null) {
Annotation a = map.get(NAME_ANNOTATION_TYPE);
@@ -110,20 +111,23 @@
}
Method[] ms = cls.getMethods();
for (int i = 0; i < ms.length; i++) {
- map = getSeamAnnotations(ms[i].getAnnotations());
- if(map == null || map.isEmpty()) continue;
-
-
+ process(ms[i], component, ds);
}
}
-
+
+ private void process(Method m, SeamJavaComponentDeclaration component,
LoadedDeclarations ds) {
+ Map<String,Annotation> map = getSeamAnnotations(m.getAnnotations());
+ if(map == null || map.isEmpty()) return;
+
+ }
+
private Object getValue(Annotation a, String method) {
try {
Method m = a.annotationType().getMethod(method, new Class[0]);
if(m == null) return null;
return m.invoke(a, new Object[0]);
} catch (Throwable e) {
- e.printStackTrace();
+ SeamCorePlugin.getPluginLog().logError(e);
}
return null;
}
Show replies by date