Author: scabanovich
Date: 2007-07-10 06:37:43 -0400 (Tue, 10 Jul 2007)
New Revision: 2363
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
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/SeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.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/SeamPropertiesDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.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
Log:
EXIN-217 save/load of last build results implemented;
ISeamObject interface added and implemented.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentDeclaration.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -14,7 +14,7 @@
* Represents declaration of seam component.
* @author Alexey Kazakov
*/
-public interface ISeamComponentDeclaration extends ISeamTextSourceReference {
+public interface ISeamComponentDeclaration extends ISeamObject, ISeamTextSourceReference
{
/**
* @return name of component.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponentMethod.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -15,7 +15,7 @@
* This interface represents only methods with types enumerated in
SeamComponentMethodType
* @author Alexey Kazakov
*/
-public interface ISeamComponentMethod extends ISeamJavaSourceReference {
+public interface ISeamComponentMethod extends ISeamJavaSourceReference, ISeamObject {
/**
* @return is @ Create method
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamContextVariable.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -14,7 +14,7 @@
* Represents Seam Context Variable.
* @author Alexey Kazakov
*/
-public interface ISeamContextVariable {
+public interface ISeamContextVariable extends ISeamObject {
/**
* @return name of context variable
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamObject.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.core;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Common interface for objects of seam model.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface ISeamObject {
+
+ /**
+ * Returns parent object of seam model.
+ * @return
+ */
+ public ISeamObject getParent();
+
+ /**
+ * Returns path of resource that declares this object.
+ * @return
+ */
+ public IPath getSourcePath();
+
+ /**
+ * Returns resource that declares this object.
+ * @return resource
+ */
+ public IResource getResource();
+
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -13,11 +13,10 @@
import java.util.Set;
import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
-public interface ISeamProject extends IProjectNature {
+public interface ISeamProject extends IProjectNature, ISeamObject {
public static String NATURE_ID = "org.jboss.tools.seam.core.seam";
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProperty.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -13,7 +13,7 @@
/**
* A property of Seam Component defined in component.xml or seam.properties files
*/
-public interface ISeamProperty extends ISeamTextSourceReference {
+public interface ISeamProperty extends ISeamObject, ISeamTextSourceReference {
/**
* @return name of this property
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamTextSourceReference.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.core;
-import org.eclipse.core.resources.IResource;
-
/**
* An interface of seam tools model object that has text source.
* @author Alexey Kazakov
@@ -19,11 +17,6 @@
public interface ISeamTextSourceReference {
/**
- * @return resource
- */
- public IResource getResource();
-
- /**
* @return start position of element in text
*/
public int getStartPosition();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -22,15 +22,12 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.tools.seam.internal.core.SeamComponent;
-import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.seam.internal.core.SeamResourceVisitor;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
-import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.java.JavaScanner;
import org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner;
import org.jboss.tools.seam.internal.core.scanner.xml.XMLScanner;
@@ -43,8 +40,9 @@
new JavaScanner(),
new XMLScanner(),
// new LibraryScanner()
- };
- SampleResourceVisitor RESOURCE_VISITOR = new SampleResourceVisitor();
+ };
+
+ SeamResourceVisitor resourceVisitor = null;
SeamProject getSeamProject() {
IProject p = getProject();
@@ -54,6 +52,14 @@
//TODO
return null;
}
+ }
+
+ SeamResourceVisitor getResourceVisitor() {
+ if(resourceVisitor == null) {
+ SeamProject p = getSeamProject();
+ resourceVisitor = new SeamResourceVisitor(p);
+ }
+ return resourceVisitor;
}
class SampleDeltaVisitor implements IResourceDeltaVisitor {
@@ -64,14 +70,14 @@
IResource resource = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
- RESOURCE_VISITOR.visit(resource);
+ getResourceVisitor().getVisitor().visit(resource);
break;
case IResourceDelta.REMOVED:
SeamProject p = getSeamProject();
if(p != null) p.pathRemoved(resource.getFullPath());
break;
case IResourceDelta.CHANGED:
- RESOURCE_VISITOR.visit(resource);
+ getResourceVisitor().getVisitor().visit(resource);
break;
}
//return true to continue visiting children.
@@ -79,36 +85,6 @@
}
}
- class SampleResourceVisitor implements IResourceVisitor {
- public boolean visit(IResource resource) {
- if(resource instanceof IFile) {
- IFile f = (IFile)resource;
- for (int i = 0; i < FILE_SCANNERS.length; i++) {
- IFileScanner scanner = FILE_SCANNERS[i];
- if(scanner.isRelevant(f)) {
- if(!scanner.isLikelyComponentSource(f)) return false;
- LoadedDeclarations c = null;
- try {
- c = scanner.parse(f);
- } catch (Exception e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- if(c != null) componentsLoaded(c, f);
- }
- }
- }
- //return true to continue visiting children.
- return true;
- }
- }
-
- void componentsLoaded(LoadedDeclarations c, IFile resource) {
- if(c == null || c.getComponents().size() + c.getFactories().size() == 0) return;
- SeamProject p = getSeamProject();
- if(p == null) return;
- p.registerComponents(c, resource.getFullPath());
- }
-
class XMLErrorHandler extends DefaultHandler {
private IFile file;
@@ -162,9 +138,11 @@
*/
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {
- if(getSeamProject().getClassPath().update()) {
- System.out.println("update from class path");
- getSeamProject().getClassPath().process();
+ SeamProject sp = getSeamProject();
+ sp.resolveStorage(kind != FULL_BUILD);
+
+ if(sp.getClassPath().update()) {
+ sp.getClassPath().process();
}
if (kind == FULL_BUILD) {
@@ -176,7 +154,8 @@
} else {
incrementalBuild(delta, monitor);
}
- }
+ }
+ sp.store();
return null;
}
@@ -202,7 +181,7 @@
protected void fullBuild(final IProgressMonitor monitor)
throws CoreException {
try {
- getProject().accept(RESOURCE_VISITOR);
+ getProject().accept(getResourceVisitor().getVisitor());
} catch (CoreException e) {
e.printStackTrace();
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
+import org.jboss.tools.seam.internal.core.SeamProject;
import org.osgi.framework.BundleContext;
/**
@@ -76,4 +79,33 @@
public static IPluginLog getPluginLog() {
return getDefault();
}
+
+ /**
+ * Factory method creating seam project instance by project resource.
+ * Returns null if
+ * (1) project does not exist
+ * (2) project is closed
+ * (3) project has no seam nature
+ * (4) creating seam project failed.
+ * @param project
+ * @return
+ */
+ public static ISeamProject getSeamProject(IProject project) {
+ if(project == null || !project.exists() || !project.isOpen()) return null;
+ try {
+ if(!project.hasNature(ISeamProject.NATURE_ID)) return null;
+ } catch (CoreException e) {
+ //ignore - all checks are done above
+ return null;
+ }
+ try {
+ SeamProject seamProject = (SeamProject)project.getNature(ISeamProject.NATURE_ID);
+ seamProject.resolveStorage(true);
+ return seamProject;
+ } catch (Exception e) {
+ getPluginLog().logError(e);
+ }
+ return null;
+ }
+
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core;
import java.util.HashMap;
@@ -6,7 +16,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
@@ -14,41 +23,17 @@
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
-public class AbstractContextVariable implements ISeamContextVariable,
ISeamTextSourceReference {
- /**
- * Path of resource where this factory is declared.
- */
- protected IPath source;
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class AbstractContextVariable extends SeamObject implements ISeamContextVariable,
ISeamTextSourceReference {
- protected IResource resource = null;
-
- /**
- * Object that allows to identify this declaration.
- */
- protected Object id;
-
protected String name;
protected ScopeType scopeType;
protected String scope;
protected Map<String,ValueInfo> attributes = new HashMap<String,
ValueInfo>();
- public Object getId() {
- return id;
- }
-
- public void setId(Object id) {
- this.id = id;
- }
-
- public void setSourcePath(IPath path) {
- source = path;
- }
-
- public IPath getSourcePath() {
- return source;
- }
-
public String getName() {
return name;
}
@@ -82,14 +67,6 @@
return 0;
}
- public IResource getResource() {
- if(resource != null) return resource;
- if(source != null) {
- resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
- }
- return resource;
- }
-
public int getStartPosition() {
// TODO Auto-generated method stub
return 0;
@@ -101,12 +78,10 @@
* @param f
* @return list of changes
*/
- public List<Change> merge(AbstractContextVariable f) {
- List<Change> changes = null;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ AbstractContextVariable f = (AbstractContextVariable)s;
- source = f.source;
- id = f.id;
-
if(!stringsEqual(name, f.name)) {
changes = Change.addChange(changes, new Change(this,
ISeamXmlComponentDeclaration.NAME, name, f.name));
name = f.name;
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-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -47,8 +47,9 @@
this.types = types;
}
- public List<Change> merge(AbstractContextVariable f) {
- List<Change> changes = super.merge(f);
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ AbstractContextVariable f = (AbstractContextVariable)s;
if(f instanceof BijectedAttribute) {
BijectedAttribute sf = (BijectedAttribute)f;
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-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -10,11 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IMethod;
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
@@ -44,9 +41,9 @@
this.autoCreate = autoCreate;
}
- public List<Change> merge(AbstractContextVariable f) {
- List<Change> changes = super.merge(f);
- SeamAnnotatedFactory af = (SeamAnnotatedFactory)f;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamAnnotatedFactory af = (SeamAnnotatedFactory)s;
if(autoCreate != af.autoCreate) {
changes = Change.addChange(changes, new Change(this,
ISeamXmlComponentDeclaration.AUTO_CREATE, autoCreate, af.autoCreate));
@@ -69,10 +66,6 @@
return valueInfo != null ? valueInfo.getLength() : 0;
}
- public IResource getResource() {
- return SeamAnnotatedFactory.this.getResource();
- }
-
public int getStartPosition() {
return valueInfo != null ? valueInfo.getStartPosition() : 0;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -29,7 +29,10 @@
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
-public class SeamComponent implements ISeamComponent {
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamComponent extends SeamObject implements ISeamComponent {
protected String name = null;
@@ -197,6 +200,9 @@
public void addDeclaration(ISeamComponentDeclaration declaration) {
if(allDeclarations.contains(declaration)) return;
allDeclarations.add(declaration);
+ if(name.equals(declaration.getName())) {
+ ((SeamObject)declaration).setParent(this);
+ }
if(declaration instanceof ISeamJavaComponentDeclaration) {
javaDeclarations.add((ISeamJavaComponentDeclaration)declaration);
} else if(declaration instanceof ISeamXmlComponentDeclaration) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -16,7 +16,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
@@ -26,37 +25,17 @@
/**
* @author Viacheslav Kabanovich
*/
-public abstract class SeamComponentDeclaration implements ISeamComponentDeclaration {
+public abstract class SeamComponentDeclaration extends SeamObject implements
ISeamComponentDeclaration {
public static final String PATH_OF_NAME = "name";
/**
- * Path of resource where this component is declared.
- */
- protected IPath source;
-
- protected IResource resource;
-
- /**
- * Object that allows to identify this declaration.
- */
- protected Object id;
-
- /**
* Seam component name.
*/
protected String name;
protected Map<String,ValueInfo> attributes = new HashMap<String,
ValueInfo>();
- public Object getId() {
- return id;
- }
-
- public void setId(Object id) {
- this.id = id;
- }
-
public String getName() {
return name;
}
@@ -65,26 +44,11 @@
this.name = name;
}
- public void setSourcePath(IPath path) {
- source = path;
- }
-
- public IPath getSourcePath() {
- return source;
- }
-
public int getLength() {
// TODO Auto-generated method stub
return 0;
}
- public IResource getResource() {
- if(resource == null && source != null) {
- resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
- }
- return resource;
- }
-
public void setResource(IResource resource) {
this.resource = resource;
}
@@ -100,8 +64,10 @@
* @param d
* @return list of changes
*/
- public List<Change> merge(SeamComponentDeclaration d) {
- List<Change> changes = null;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamComponentDeclaration d = (SeamComponentDeclaration)s;
+
if(!source.equals(d.source)) {
source = d.source;
}
@@ -134,10 +100,6 @@
return valueInfo != null ? valueInfo.getLength() : 0;
}
- public IResource getResource() {
- return SeamComponentDeclaration.this.getResource();
- }
-
public int getStartPosition() {
return valueInfo != null ? valueInfo.getStartPosition() : 0;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -5,12 +5,11 @@
import org.jboss.tools.seam.core.ISeamComponentMethod;
import org.jboss.tools.seam.core.SeamComponentMethodType;
-public class SeamComponentMethod implements ISeamComponentMethod {
+public class SeamComponentMethod extends SeamObject implements ISeamComponentMethod {
boolean create = false;
boolean destroy = false;
IMember javaSource = null;
- IResource resource = null;
public boolean isCreate() {
return create;
@@ -47,7 +46,8 @@
}
public IResource getResource() {
- if(resource == null && javaSource != null) {
+ if(resource == null) {
+ if(javaSource == null) return super.getResource();
resource = javaSource.getResource();
}
return resource;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -58,15 +58,18 @@
}
public void addBijectedAttribute(IBijectedAttribute attribute) {
- bijectedAttributes.add(attribute);
+ bijectedAttributes.add(attribute);
+ adopt(attribute);
}
public void addMethod(ISeamComponentMethod method) {
componentMethods.add(method);
+ adopt(method);
}
public void addRole(IRole role) {
- roles.add(role);
+ roles.add(role);
+ adopt(role);
}
public Set<IBijectedAttribute> getBijectedAttributes() {
@@ -115,7 +118,7 @@
public Set<IRole> getRoles() {
return roles;
}
-
+
public boolean isEntity() {
return entity;
}
@@ -154,9 +157,9 @@
* @param d
* @return list of changes
*/
- public List<Change> merge(SeamComponentDeclaration d) {
- List<Change> changes = super.merge(d);
- SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)d;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)s;
if(!stringsEqual(className, jd.className)) {
changes = Change.addChange(changes, new Change(this, "class", className,
jd.className));
className = jd.className;
@@ -183,8 +186,11 @@
//TODO do real merge and add changes to children
this.bijectedAttributes = jd.bijectedAttributes;
+ for (IBijectedAttribute a: bijectedAttributes) adopt(a);
this.componentMethods = jd.componentMethods;
- this.roles = jd.roles;
+ for (ISeamComponentMethod m: componentMethods) adopt(m);
+ this.roles = jd.roles;
+ for (IRole role: roles) adopt(role);
changes = Change.addChange(changes, children);
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-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -27,7 +27,7 @@
}
public IResource getResource() {
- return javaSource == null ? null : javaSource.getTypeRoot().getResource();
+ return javaSource == null ? super.getResource() :
javaSource.getTypeRoot().getResource();
}
public int getStartPosition() {
@@ -41,11 +41,11 @@
}
}
- public List<Change> merge(AbstractContextVariable f) {
- List<Change> changes = super.merge(f);
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
- if(f instanceof SeamJavaContextVariable) {
- SeamJavaContextVariable sf = (SeamJavaContextVariable)f;
+ if(s instanceof SeamJavaContextVariable) {
+ SeamJavaContextVariable sf = (SeamJavaContextVariable)s;
javaSource = sf.javaSource;
resource = sf.resource;
}
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.seam.core.ISeamObject;
+import org.jboss.tools.seam.core.event.Change;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamObject implements ISeamObject {
+ /**
+ * Object that allows to identify this object.
+ */
+ protected Object id;
+
+ /**
+ * Path of resource where this object is declared.
+ */
+ protected IPath source;
+
+ /**
+ * Resource where this object is declared.
+ */
+ protected IResource resource = null;
+
+ /**
+ * Parent seam object in the seam model.
+ */
+ protected ISeamObject parent;
+
+ public SeamObject() {}
+
+ public Object getId() {
+ return id;
+ }
+
+ /**
+ * Sets id for this object.
+ * For most objects it is object of Java or XML model
+ * from which this object is loaded.
+ */
+ public void setId(Object id) {
+ this.id = id;
+ }
+
+ /**
+ * Sets path of resource that declares this object.
+ */
+ public void setSourcePath(IPath path) {
+ source = path;
+ }
+
+ /**
+ * Returns path of resource that declares this object.
+ * @return
+ */
+ public IPath getSourcePath() {
+ if(source == null && parent != null) return parent.getSourcePath();
+ return source;
+ }
+
+ public IResource getResource() {
+ if(resource != null) return resource;
+ if(source != null) {
+ resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
+ }
+ return resource;
+ }
+
+ /**
+ * Returns parent object of seam model.
+ * @return
+ */
+ public ISeamObject getParent() {
+ return parent;
+ }
+
+ public void setParent(ISeamObject parent) {
+ this.parent = parent;
+ }
+
+ protected void adopt(ISeamObject child) {
+ ((SeamObject)child).setParent(this);
+ }
+
+
+ /**
+ * Merges loaded object into current object.
+ * If changes were done returns a list of changes.
+ * @param f
+ * @return list of changes
+ */
+ public List<Change> merge(SeamObject s) {
+ source = s.source;
+ id = s.id;
+
+ return null;
+ }
+
+}
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-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -18,10 +19,14 @@
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
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.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamContextVariable;
@@ -30,6 +35,7 @@
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
@@ -40,9 +46,13 @@
/**
* @author Viacheslav Kabanovich
*/
-public class SeamProject implements ISeamProject {
+public class SeamProject extends SeamObject implements ISeamProject {
IProject project;
ClassPath classPath = new ClassPath(this);
+
+ Set<IPath> sourcePaths = new HashSet<IPath>();
+ private boolean isStorageResolved = false;
+
Map<String, SeamComponent> allComponents = new HashMap<String,
SeamComponent>();
protected Set<ISeamFactory> allFactories = new HashSet<ISeamFactory>();
Set<ISeamContextVariable> allVariables = new
HashSet<ISeamContextVariable>();
@@ -66,6 +76,7 @@
public void setProject(IProject project) {
this.project = project;
+ setSourcePath(project.getFullPath());
classPath.init();
load();
}
@@ -73,20 +84,62 @@
public ClassPath getClassPath() {
return classPath;
}
+
+ public void resolveStorage(boolean load) {
+ if(isStorageResolved) return;
+ if(load) {
+ load();
+ } else {
+ isStorageResolved = true;
+ }
+ }
/**
* Loads results of last build, which are considered
* actual until next build.
*/
- protected void load() {
+ public void load() {
+ if(isStorageResolved) return;
+ isStorageResolved = true;
+ long begin = System.currentTimeMillis();
+ if(getClassPath().update()) {
+ getClassPath().process();
+ }
+ File file = getStorageFile();
+ if(file == null || !file.isFile()) return;
+ String s = FileUtil.readFile(file);
+ String[] ps = s.split("\n");
+ for (int i = 0; i < ps.length; i++) {
+ IPath path = new Path(ps[i].trim());
+ if(sourcePaths.contains(path)) continue;
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if(f == null || !f.exists() || !f.isSynchronized(IResource.DEPTH_ZERO)) continue;
+ SeamResourceVisitor b = new SeamResourceVisitor(this);
+ b.visit(f);
+ }
+ long end = System.currentTimeMillis();
+ System.out.println("loaded in " + (end - begin));
}
/**
* Stores results of last build, so that on exit/enter Eclipse
* load them without rebuilding project
*/
- protected void store() {
+ public void store() {
+ File file = getStorageFile();
+ file.getParentFile().mkdirs();
+ StringBuffer sb = new StringBuffer();
+ for (IPath path : sourcePaths) {
+ sb.append(path.toString()).append('\n');
+ }
+ FileUtil.writeFile(file, sb.toString());
}
+
+ private File getStorageFile() {
+ IPath path = SeamCorePlugin.getDefault().getStateLocation();
+ File file = new File(path.toFile(), "projects/" + project.getName());
+ return file;
+ }
public SeamValidationContext getValidationContext() {
if(validationContext==null) {
@@ -119,6 +172,7 @@
pathRemoved(source);
return;
}
+ if(!sourcePaths.contains(source)) sourcePaths.add(source);
Map<Object,ISeamComponentDeclaration> currentComponents =
findComponentDeclarations(source);
@@ -204,6 +258,9 @@
fireChanges(changes);
continue;
}
+ if(factories[i].getParent() == null) {
+ adopt(factories[i]);
+ }
allFactories.add(factories[i]);
allVariables.add(factories[i]);
addedFactories = Change.addChange(addedFactories, new Change(this, null, null,
loaded));
@@ -222,6 +279,8 @@
* @param source
*/
public void pathRemoved(IPath source) {
+ if(!sourcePaths.contains(source)) return;
+ sourcePaths.remove(source);
Iterator<SeamComponent> iterator = allComponents.values().iterator();
while(iterator.hasNext()) {
List<Change> changes = null;
@@ -436,6 +495,8 @@
SeamComponent newComponent(String name) {
SeamComponent c = new SeamComponent();
c.setName(name);
+ c.setId(name);
+ c.setParent(this);
return c;
}
@@ -478,4 +539,7 @@
}
return result;
}
+}
+
+class InnerBuilder {
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -17,6 +17,7 @@
public void addProperty(ISeamProperty property) {
properties.put(property.getName(), property);
+ adopt(property);
}
public List<ISeamProperty> getProperties(String propertyName) {
@@ -50,9 +51,9 @@
* @param d
* @return list of changes
*/
- public List<Change> merge(SeamComponentDeclaration d) {
- List<Change> changes = super.merge(d);
- SeamPropertiesDeclaration pd = (SeamPropertiesDeclaration)d;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamPropertiesDeclaration pd = (SeamPropertiesDeclaration)s;
Change children = new Change(this, null, null, null);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -14,12 +14,10 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IResource;
import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.event.Change;
-public class SeamProperty implements ISeamProperty {
- protected Object id;
+public class SeamProperty extends SeamObject implements ISeamProperty {
protected String name;
protected Object value;
protected int startPosition = -1;
@@ -41,14 +39,6 @@
this.value = value;
}
- public Object getId() {
- return id;
- }
-
- public void setId(Object id) {
- this.id = id;
- }
-
public String getName() {
return name;
}
@@ -77,18 +67,11 @@
this.value = value;
}
- /**
- * @see org.jboss.tools.seam.core.ISeamXmlElement#getResource()
- */
- public IResource getResource() {
- // TODO Auto-generated method stub
- return null;
- }
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+
+ SeamProperty d = (SeamProperty)s;
- public List<Change> merge(SeamProperty d) {
- List<Change> changes = null;
-
- id = d.id;
startPosition = d.startPosition;
length = d.length;
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
+import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
+import org.jboss.tools.seam.internal.core.scanner.java.JavaScanner;
+import org.jboss.tools.seam.internal.core.scanner.xml.XMLScanner;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamResourceVisitor implements IResourceVisitor {
+ static IFileScanner[] FILE_SCANNERS = {
+ new JavaScanner(),
+ new XMLScanner(),
+ };
+ SeamProject p;
+
+ public SeamResourceVisitor(SeamProject p) {
+ this.p = p;
+ }
+
+ public IResourceVisitor getVisitor() {
+ return this;
+ }
+
+ public boolean visit(IResource resource) {
+ if(resource instanceof IFile) {
+ IFile f = (IFile)resource;
+ for (int i = 0; i < FILE_SCANNERS.length; i++) {
+ IFileScanner scanner = FILE_SCANNERS[i];
+ if(scanner.isRelevant(f)) {
+ if(!scanner.isLikelyComponentSource(f)) return false;
+ LoadedDeclarations c = null;
+ try {
+ c = scanner.parse(f);
+ } catch (Exception e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ if(c != null) componentsLoaded(c, f);
+ }
+ }
+ }
+ //return true to continue visiting children.
+ return true;
+ }
+
+ void componentsLoaded(LoadedDeclarations c, IFile resource) {
+ if(c == null || c.getComponents().size() + c.getFactories().size() == 0) return;
+ p.registerComponents(c, resource.getFullPath());
+ }
+
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -83,9 +83,9 @@
* @param d
* @return list of changes
*/
- public List<Change> merge(SeamComponentDeclaration d) {
- List<Change> changes = super.merge(d);
- SeamXmlComponentDeclaration xd = (SeamXmlComponentDeclaration)d;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamXmlComponentDeclaration xd = (SeamXmlComponentDeclaration)s;
if(!stringsEqual(className, xd.className)) {
changes = Change.addChange(changes, new Change(this, CLASS, className,
xd.className));
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2007-07-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -38,9 +38,9 @@
this.value = value;
}
- public List<Change> merge(AbstractContextVariable f) {
- List<Change> changes = super.merge(f);
- SeamXmlFactory xf = (SeamXmlFactory)f;
+ public List<Change> merge(SeamObject s) {
+ List<Change> changes = super.merge(s);
+ SeamXmlFactory xf = (SeamXmlFactory)s;
if(!stringsEqual(value, xf.value)) {
changes = Change.addChange(changes, new Change(this, "value", value,
xf.value));
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-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -133,7 +133,7 @@
MethodDeclaration m = n.getNode();
BijectedAttribute att = new BijectedAttribute();
- component.getBijectedAttributes().add(att);
+ component.addBijectedAttribute(att);
BijectedAttributeType[] types = (in == null) ? new
BijectedAttributeType[]{BijectedAttributeType.OUT}
: (out == null) ? new BijectedAttributeType[]{BijectedAttributeType.IN}
@@ -164,7 +164,7 @@
MethodDeclaration m = n.getNode();
SeamComponentMethod cm = new SeamComponentMethod();
- component.getMethods().add(cm);
+ component.addMethod(cm);
if(aCreate != null) cm.setCreate(true);
if(aDestroy != null) cm.setDestroy(true);
@@ -203,6 +203,8 @@
ValueInfo scope = ValueInfo.getValueInfo(role, "scope");
if(scope != null) r.setScope(scope);
+
+ component.addRole(r);
}
private Annotation findAnnotation(AnnotatedASTNode<?> n, String type) {
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-09
16:37:13 UTC (rev 2362)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassScanner.java 2007-07-10
10:37:43 UTC (rev 2363)
@@ -190,7 +190,7 @@
private void processBijection(Member m, Annotation in, Annotation out,
SeamJavaComponentDeclaration component, LoadedDeclarations ds) {
if(in == null && out == null) return;
BijectedAttribute att = new BijectedAttribute();
- component.getBijectedAttributes().add(att);
+ component.addBijectedAttribute(att);
BijectedAttributeType[] types = (in == null) ? new
BijectedAttributeType[]{BijectedAttributeType.OUT}
: (out == null) ? new BijectedAttributeType[]{BijectedAttributeType.IN}