Author: scabanovich
Date: 2007-07-06 11:32:10 -0400 (Fri, 06 Jul 2007)
New Revision: 2348
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.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/SeamAnnotations.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java
Log:
EXIN-217 Java class scanner is being developed.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-06
15:03:58 UTC (rev 2347)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-06
15:32:10 UTC (rev 2348)
@@ -10,9 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.List;
+
import org.eclipse.jdt.core.IMember;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.event.Change;
/**
* @author Viacheslav Kabanovich
@@ -43,4 +47,28 @@
this.types = types;
}
+ public List<Change> merge(AbstractContextVariable f) {
+ List<Change> changes = super.merge(f);
+
+ if(f instanceof BijectedAttribute) {
+ BijectedAttribute sf = (BijectedAttribute)f;
+ if(!typesAreEqual(types, sf.types)) {
+ changes = Change.addChange(changes, new Change(this,
ISeamXmlComponentDeclaration.NAME, name, f.name));
+ this.types = sf.types;
+ }
+ }
+
+ return changes;
+ }
+
+ boolean typesAreEqual(BijectedAttributeType[] types1, BijectedAttributeType[] types2) {
+ if(types1 == null || types2 == null) return types2 == types1;
+ if(types1.length != types2.length) return false;
+ for (int i = 0; i < types1.length; i++) {
+ if(types1[i] != types2[i]) return false;
+ }
+ return true;
+
+ }
+
}
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-06
15:03:58 UTC (rev 2347)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-06
15:32:10 UTC (rev 2348)
@@ -120,6 +120,8 @@
loaded.setSourcePath(source);
String name = loaded.getName();
+
+ boolean nameChanged = current != null && !name.equals(current.getName());
SeamComponent c = getComponent(name);
@@ -132,16 +134,28 @@
fireChanges(cchanges);
//TODO if java, fire to others
}
- continue;
+ if(nameChanged) {
+ Map<Object,ISeamComponentDeclaration> old = new HashMap<Object,
ISeamComponentDeclaration>();
+ old.put(current.getId(), current);
+ componentDeclarationsRemoved(old);
+ loaded = current;
+ current = null;
+ } else {
+ continue;
+ }
}
if(c == null && name != null) {
c = newComponent(name);
allComponents.put(name, c);
allVariables.add(c);
+ c.addDeclaration(loaded);
addedComponents = Change.addChange(addedComponents, new Change(this, null, null,
c));
+ } else if(c != null) {
+ c.addDeclaration(loaded);
+ List<Change> changes = Change.addChange(null, new Change(c, null, null,
loaded));
+ fireChanges(changes);
}
- if(c != null) c.addDeclaration(components[i]);
if(loaded instanceof ISeamJavaComponentDeclaration) {
SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)loaded;
@@ -155,7 +169,7 @@
fireChanges(changes);
}
} else if(loaded instanceof ISeamXmlComponentDeclaration) {
- ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)components[i];
+ ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)loaded;
String className = xml.getClassName();
SeamJavaComponentDeclaration j = javaDeclarations.get(className);
if(j != null) {
@@ -250,7 +264,9 @@
if(removed.containsKey(ds[i].getId())) {
if(ds[i] instanceof ISeamJavaComponentDeclaration) {
String className = ((ISeamJavaComponentDeclaration)ds[i]).getClassName();
- javaDeclarations.remove(className);
+ if(javaDeclarations.get(className) == ds[i]) {
+ javaDeclarations.remove(className);
+ }
}
c.removeDeclaration(ds[i]);
changes = Change.addChange(changes, new Change(c, null, ds[i], null));
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
15:03:58 UTC (rev 2347)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/SeamAnnotations.java 2007-07-06
15:32:10 UTC (rev 2348)
@@ -14,5 +14,8 @@
public static String DESTROY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Destroy";
public static String FACTORY_ANNOTATION_TYPE = SEAM_ANNOTATION_TYPE_PREFIX +
"Factory";
+
+
+ public static String STATEFUL_TYPE = "javax.ejb.Stateful";
}
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
15:03:58 UTC (rev 2347)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-06
15:32:10 UTC (rev 2348)
@@ -133,6 +133,16 @@
if(ms != null) for (int i = 0; i < ms.length; i++) {
process(ms[i], component, ds);
}
+
+ Field[] fs = null;
+ try {
+ fs = cls.getFields();
+ } catch (NoClassDefFoundError e) {
+ //ignore
+ }
+ if(fs != null) for (int i = 0; i < fs.length; i++) {
+ //TODO
+ }
}
private void process(Method m, SeamJavaComponentDeclaration component,
LoadedDeclarations ds) {
Show replies by date