Author: scabanovich
Date: 2007-07-16 07:38:06 -0400 (Mon, 16 Jul 2007)
New Revision: 2441
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.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/scanner/xml/XMLScanner.java
Log:
EXIN-218 - removed dependency on jsfnature
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-16 11:37:27
UTC (rev 2440)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-16 11:38:06
UTC (rev 2441)
@@ -22,7 +22,8 @@
org.eclipse.ant.core,
org.eclipse.wst.validation,
org.eclipse.jst.j2ee.web,
- org.eclipse.jst.j2ee
+ org.eclipse.jst.j2ee,
+ org.eclipse.jst.ws
Provide-Package: org.jboss.tools.seam.core,
org.jboss.tools.seam.internal.core,
org.jboss.tools.seam.internal.core.scanner
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/InnerModelHelper.java 2007-07-16
11:38:06 UTC (rev 2441)
@@ -0,0 +1,51 @@
+package org.jboss.tools.seam.internal.core;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelConstants;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+public class InnerModelHelper {
+
+ public static XModel createXModel(IProject project) {
+ IModelNature n = EclipseResourceUtil.getModelNature(project.getProject());
+ if(n != null) return n.getModel();
+
+ XModel model =
EclipseResourceUtil.createObjectForResource(project.getProject()).getModel();
+ XModelObject webinf = model.getByPath("FileSystems/WEB-INF");
+ if(webinf != null) return model;
+
+ IPath webInfPath = J2EEUtils.getWebInfPath(project);
+
+ if(webInfPath == null) return model;
+
+ IFolder webInfFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(webInfPath);
+
+ model.getProperties().setProperty(XModelConstants.WORKSPACE,
webInfFolder.getLocation().toString());
+
+ XModelObject fs = model.getByPath("FileSystems");
+ webinf = model.createModelObject("FileSystemFolder", null);
+ webinf.setAttributeValue("name", "WEB-INF");
+ webinf.setAttributeValue("location", "%redhat.workspace%");
+ fs.addChild(webinf);
+
+ XModelObject webroot = model.createModelObject("FileSystemFolder", null);
+ webroot.setAttributeValue("name", "WEB-ROOT");
+ webroot.setAttributeValue("location", "%redhat.workspace%/..");
+ fs.addChild(webroot);
+
+ XModelObject lib = model.createModelObject("FileSystemFolder", null);
+ lib.setAttributeValue("name", "lib");
+ lib.setAttributeValue("location", "%redhat.workspace%/lib");
+ fs.addChild(lib);
+
+ return model;
+ }
+
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2007-07-16
11:37:27 UTC (rev 2440)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2007-07-16
11:38:06 UTC (rev 2441)
@@ -36,6 +36,7 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.InnerModelHelper;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -73,8 +74,7 @@
* Initialization of inner model.
*/
public void init() {
- IModelNature n = EclipseResourceUtil.getModelNature(project.getProject());
- model = n == null ?
EclipseResourceUtil.createObjectForResource(project.getProject()).getModel() :
n.getModel();
+ model = InnerModelHelper.createXModel(project.getProject());
}
static String[] SYSTEM_JARS = {"rt.jar", "jsse.jar",
"jce.jar", "charsets.jar"};
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-16
11:37:27 UTC (rev 2440)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/LibraryScanner.java 2007-07-16
11:38:06 UTC (rev 2441)
@@ -28,12 +28,14 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
+import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.InnerModelHelper;
import org.jboss.tools.seam.internal.core.SeamPropertiesDeclaration;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -61,7 +63,9 @@
}
public boolean isLikelyComponentSource(IFile f) {
- XModelObject o = EclipseResourceUtil.getObjectByResource(f);
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return false;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
if(o == null) return false;
if(!o.getModelEntity().getName().equals("FileSystemJar")) {
((FileSystemsImpl)o.getModel().getByPath("FileSystems")).updateOverlapped();
@@ -72,7 +76,9 @@
}
public LoadedDeclarations parse(IFile f) throws Exception {
- XModelObject o = EclipseResourceUtil.getObjectByResource(f);
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return null;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
if(o == null) return null;
if(!o.getModelEntity().getName().equals("FileSystemJar")) {
((FileSystemsImpl)o.getModel().getByPath("FileSystems")).updateOverlapped();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-16
11:37:27 UTC (rev 2440)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-16
11:38:06 UTC (rev 2441)
@@ -21,9 +21,11 @@
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.internal.core.InnerModelHelper;
import org.jboss.tools.seam.internal.core.SeamProperty;
import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamXmlFactory;
@@ -54,7 +56,9 @@
*/
public boolean isLikelyComponentSource(IFile f) {
if(!f.isSynchronized(IFile.DEPTH_ZERO) || !f.exists()) return false;
- XModelObject o = EclipseResourceUtil.getObjectByResource(f);
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return false;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
if(o == null) return false;
if(o.getModelEntity().getName().startsWith("FileSeamComponents")) return
true;
//TODO Above does not include .component.xml with root element <component>
@@ -69,7 +73,9 @@
* @throws Exception
*/
public LoadedDeclarations parse(IFile f) throws Exception {
- XModelObject o = EclipseResourceUtil.getObjectByResource(f);
+ XModel model = InnerModelHelper.createXModel(f.getProject());
+ if(model == null) return null;
+ XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
return parse(o, f.getFullPath());
}