Author: scabanovich
Date: 2007-07-10 08:11:33 -0400 (Tue, 10 Jul 2007)
New Revision: 2366
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/SeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.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
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/LibraryScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java
Log:
EXIN-217 Roles and bijected attributes added/removed to variables set of seam project.
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-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -12,7 +12,6 @@
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;
@@ -27,10 +26,6 @@
public BijectedAttribute() {
}
- public void setMember(IMember javaSource) {
- this.javaSource = javaSource;
- }
-
public BijectedAttributeType[] getTypes() {
return types;
}
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-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -29,10 +29,6 @@
return (IMethod)javaSource;
}
- public void setMethod(IMethod method) {
- this.javaSource = method;
- }
-
public boolean isAutoCreate() {
return autoCreate;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2007-07-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -14,6 +14,10 @@
public IMember getSourceMember() {
return javaSource;
}
+
+ public void setSourceMember(IMember javaSource) {
+ this.javaSource = javaSource;
+ }
public int getLength() {
if(javaSource == null) return 0;
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-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -12,6 +12,7 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -101,7 +102,6 @@
public void load() {
if(isStorageResolved) return;
isStorageResolved = true;
- long begin = System.currentTimeMillis();
if(getClassPath().update()) {
getClassPath().process();
}
@@ -117,8 +117,6 @@
SeamResourceVisitor b = new SeamResourceVisitor(this);
b.visit(f);
}
- long end = System.currentTimeMillis();
-// System.out.println("loaded in " + (end - begin));
}
/**
@@ -225,6 +223,8 @@
if(loaded instanceof ISeamJavaComponentDeclaration) {
SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)loaded;
javaDeclarations.put(jd.getClassName(), jd);
+ allVariables.addAll(jd.getBijectedAttributes());
+ allVariables.addAll(jd.getRoles());
Set<ISeamComponent> cs = getComponentsByClass(jd.getClassName());
for (ISeamComponent ci: cs) {
if(ci == c) continue;
@@ -290,8 +290,11 @@
if(ds[i].source.equals(source)) {
c.removeDeclaration(ds[i]);
if(ds[i] instanceof ISeamJavaComponentDeclaration) {
- String className = ((ISeamJavaComponentDeclaration)ds[i]).getClassName();
+ ISeamJavaComponentDeclaration jd = (ISeamJavaComponentDeclaration)ds[i];
+ String className = jd.getClassName();
javaDeclarations.remove(className);
+ allVariables.removeAll(jd.getBijectedAttributes());
+ allVariables.removeAll(jd.getRoles());
}
changes = Change.addChange(changes, new Change(c, null, ds[i], null));
}
@@ -329,6 +332,19 @@
}
void componentDeclarationsRemoved(Map<Object,ISeamComponentDeclaration> removed)
{
+ Collection<ISeamComponentDeclaration> declarations = removed.values();
+ for (ISeamComponentDeclaration declaration: declarations) {
+ if(declaration instanceof ISeamJavaComponentDeclaration) {
+ ISeamJavaComponentDeclaration jd = (ISeamJavaComponentDeclaration)declaration;
+ String className = jd.getClassName();
+ if(javaDeclarations.get(className) == jd) {
+ javaDeclarations.remove(className);
+ }
+ allVariables.removeAll(jd.getRoles());
+ allVariables.removeAll(jd.getBijectedAttributes());
+ }
+ }
+
Iterator<SeamComponent> iterator = allComponents.values().iterator();
while(iterator.hasNext()) {
List<Change> changes = null;
@@ -336,12 +352,6 @@
SeamComponentDeclaration[] ds = c.getAllDeclarations().toArray(new
SeamComponentDeclaration[0]);
for (int i = 0; i < ds.length; i++) {
if(removed.containsKey(ds[i].getId())) {
- if(ds[i] instanceof ISeamJavaComponentDeclaration) {
- String className = ((ISeamJavaComponentDeclaration)ds[i]).getClassName();
- 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/ComponentBuilder.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -115,7 +115,7 @@
ValueInfo autoCreate = ValueInfo.getValueInfo(a, "autoCreate");
SeamAnnotatedFactory factory = new SeamAnnotatedFactory();
- factory.setMethod(findMethod(m));
+ factory.setSourceMember(findMethod(m));
factory.setName(factoryName);
if(autoCreate != null) factory.setAutoCreate(true);
if(scope != null) {
@@ -152,7 +152,7 @@
ValueInfo scope = ValueInfo.getValueInfo(a, "scope");
if(scope != null) att.setScopeAsString(scope.getValue());
- att.setMember(findMethod(m));
+ att.setSourceMember(findMethod(m));
}
}
@@ -194,11 +194,12 @@
void createRole(Annotation role) {
Role r = new Role();
r.setSourcePath(component.getSourcePath());
- r.setId(component.getSourceMember());
+ r.setSourceMember(component.getSourceMember());
ValueInfo name = ValueInfo.getValueInfo(role, "name");
if(name == null) return;
+ r.setId("" + component.getName() + ":" + name.getValue());
r.setName(name);
ValueInfo scope = ValueInfo.getValueInfo(role, "scope");
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-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -176,7 +176,7 @@
IMethod im = findIMethod(component, m);
factory.setId(im);
- factory.setMethod(im);
+ factory.setSourceMember(im);
factory.setName(name);
Object scope = getValue(a, "scope");
@@ -206,7 +206,7 @@
if(scope != null) att.setScopeAsString(scope.toString());
IMember im = findIMember(component, m);
- att.setMember(im);
+ att.setSourceMember(im);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -81,6 +81,7 @@
public boolean isLikelyComponentSource(XModelObject o) {
if(o == null) return false;
+ if(o.getChildByPath("seam.properties") != null) return true;
if(o.getChildByPath("META-INF/seam.properties") != null) return true;
if(o.getChildByPath("META-INF/components.xml") != null) return true;
return false;
@@ -90,6 +91,7 @@
if(o == null) return null;
sourcePath = path;
XModelObject seamProperties = o.getChildByPath("META-INF/seam.properties");
+ if(seamProperties == null) seamProperties =
o.getChildByPath("seam.properties");
XModelObject componentsXML = o.getChildByPath("META-INF/components.xml");
if(componentsXML == null && seamProperties == null) return null;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java 2007-07-10
11:00:39 UTC (rev 2365)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java 2007-07-10
12:11:33 UTC (rev 2366)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.validation;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -20,8 +19,8 @@
public ISeamProject getSeamProject() {
ISeamProject project = null;
try {
- project = (ISeamProject)getProject().getNature(ISeamProject.NATURE_ID);
- } catch (CoreException e) {
+ project = SeamCorePlugin.getSeamProject(getProject());
+ } catch (Exception e) {
SeamCorePlugin.getDefault().logError("Can't get Seam Project", e);
}
return project;