Author: dgolovin
Date: 2007-07-25 04:40:20 -0400 (Wed, 25 Jul 2007)
New Revision: 2648
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
Log:
http://jira.jboss.org/jira/browse/EXIN-221
creating ear seam project
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java 2007-07-25
08:40:20 UTC (rev 2648)
@@ -0,0 +1,92 @@
+package org.jboss.tools.jsf.project.facet;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class PostInstallJsfFacetDelegate implements IDelegate {
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ writeXModel(project);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ EclipseResourceUtil.addNatureToProject(project,
"org.jboss.tools.jsf.jsfnature");
+ }
+
+ private void writeXModel(IProject project) {
+ String projectName = project.getName();
+ String webContent = "WebContent";
+
+ IVirtualComponent com = ComponentCore.createComponent(project);
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+
+ webContent = folder.getLocation().lastSegment();
+
+ if(webContent == null) {
+ webContent = "WebContent";
+ }
+ String src = "src";
+
+ String[] srcs = EclipseResourceUtil.getJavaProjectSrcLocations(project);
+ if (srcs.length > 0) {
+ src =
srcs[0].replace('\\','/').substring(srcs[0].lastIndexOf('/') +
1);
+ }
+ File location = new
File(project.getLocation().toFile(),".settings/org.jboss.tools.jst.web.xml");
+
+ Object[] arguments = {
+ projectName,
+ webContent,
+ src
+ };
+ String body = MessageFormat.format(XMODEL, arguments);
+
+ org.jboss.tools.common.util.FileUtil.writeFile(location, body);
+ }
+
+ /**
+ * {0} - project name
+ * {1} - WebContent folder name
+ * {2} - src folder name
+ */
+ private static String XMODEL =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<FILESYSTEMS APPLICATION_NAME=\"{0}\"
ENTITY=\"FileSystems\"" +
+ " VERSION=\"2.0.0\" WORKSPACE_HOME=\"./{1}/WEB-INF\">"
+
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"
LOCATION=\"%redhat.workspace%\" NAME=\"WEB-INF\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"
INFO=\"Content-Type=Web\"" +
+ " LOCATION=\"%redhat.workspace%/..\"
NAME=\"WEB-ROOT\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"" +
+ " LOCATION=\"%redhat.workspace%/../../{2}\"
NAME=\"src\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"
LOCATION=\"%redhat.workspace%/lib\" NAME=\"lib\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"" +
+ " LOCATION=\"%redhat.workspace%/classes\"
NAME=\"classes\"/>" +
+ "<WEB ENTITY=\"JstWeb\" MODEL_PATH=\"/web.xml\"
SERVLET_VERSION=\"2.4\">" +
+ " <MODULE ENTITY=\"WebJSFModule\"
MODEL_PATH=\"/faces-config.xml\"" +
+ " ROOT=\"WEB-ROOT\" SRC=\"src\"
URI=\"/WEB-INF/faces-config.xml\"/>" +
+ "</WEB>" +
+ "</FILESYSTEMS>"
+ ;
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component 2007-07-25
08:40:20 UTC (rev 2648)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="@projectName@">
+<wb-resource deploy-path="/" source-path="/EarContent"/>
+<dependent-module deploy-path="/"
handle="module:/resource/@projectName@-ejb/@projectName@-ejb">
+<dependency-type>uses</dependency-type>
+</dependent-module>
+<dependent-module deploy-path="/"
handle="module:/resource/@projectName@/@projectName@">
+<dependency-type>uses</dependency-type>
+</dependent-module>
+</wb-module>
+</project-modules>
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml 2007-07-25
08:40:20 UTC (rev 2648)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_5.xsd"
+ version="5">
+
+ <display-name>t2</display-name>
+
+ <module>
+ <web>
+ <web-uri>@projectName@.war</web-uri>
+ <context-root>/@projectName@</context-root>
+ </web>
+ </module>
+
+ <module>
+ <ejb>@projectName(a)-ejb.jar</ejb>
+ </module>
+
+ <!-- Seam and EL -->
+ <module>
+ <java>jboss-seam.jar</java>
+ </module>
+
+ <!-- jBPM -->
+ <module>
+ <java>jbpm-3.1.4.jar</java>
+ </module>
+
+ <!-- Drools and dependencies -->
+ <module>
+ <java>drools-core-3.0.5.jar</java>
+ </module>
+ <module>
+ <java>drools-compiler-3.0.5.jar</java>
+ </module>
+ <module>
+ <java>janino-2.4.3.jar</java>
+ </module>
+ <module>
+ <java>antlr-2.7.6.jar</java>
+ </module>
+ <module>
+ <java>antlr-3.0ea8.jar</java>
+ </module>
+ <module>
+ <java>commons-jci-core-1.0-406301.jar</java>
+ </module>
+ <module>
+ <java>commons-jci-janino-2.4.3.jar</java>
+ </module>
+ <module>
+ <java>stringtemplate-2.3b6.jar</java>
+ </module>
+
+</application>
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component 2007-07-25
08:40:20 UTC (rev 2648)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="@projectName@-ejb">
+<wb-resource deploy-path="/" source-path="/ejbModule"/>
+<property name="java-output-path" value="build/classes"/>
+</wb-module>
+</project-modules>
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF 2007-07-25
08:40:20 UTC (rev 2648)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Class-Path: jboss-seam.jar