JBoss Tools SVN: r4396 - in trunk/seam: plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-10-21 02:33:02 -0400 (Sun, 21 Oct 2007)
New Revision: 4396
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1107 Seam 2 support
+Seam 2 facet
+Seam 2 installdelegate (copy of Seam 1 installdelegate to avoid "hurting" seam 1 functionallity)
+Allow users to have a seam 2 runtime
+Fixed a couple of spellingerrors
-Generated Test project is not 100% yet
-There is no filtering of Seam version in the wizard page
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-10-21 06:33:02 UTC (rev 4396)
@@ -1,72 +1,72 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension
- id="seambuilder"
- name="Seam Builder"
- point="org.eclipse.core.resources.builders">
- <builder
- hasNature="false">
- <run
- class="org.jboss.tools.seam.core.SeamCoreBuilder">
- </run>
- </builder>
- </extension>
- <extension
- id="seamnature"
- name="Seam Project Nature"
- point="org.eclipse.core.resources.natures">
- <runtime>
- <run
- class="org.jboss.tools.seam.internal.core.SeamProject">
- </run>
- </runtime>
- <builder
- id="org.jboss.tools.seam.core.seambuilder">
- </builder>
- </extension>
-
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.jboss.tools.seam.internal.core.SeamPreferenceInitializer"/>
- <initializer
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreferenceInitializer">
- </initializer>
- </extension>
-
- <extension
- point="org.eclipse.wst.common.project.facet.core.facets">
- <project-facet
- id="jst.seam">
- <label>
- Seam
- </label>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ id="seambuilder"
+ name="Seam Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ hasNature="false">
+ <run
+ class="org.jboss.tools.seam.core.SeamCoreBuilder">
+ </run>
+ </builder>
+ </extension>
+ <extension
+ id="seamnature"
+ name="Seam Project Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.jboss.tools.seam.internal.core.SeamProject">
+ </run>
+ </runtime>
+ <builder
+ id="org.jboss.tools.seam.core.seambuilder">
+ </builder>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.seam.internal.core.SeamPreferenceInitializer"/>
+ <initializer
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreferenceInitializer">
+ </initializer>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+ <project-facet
+ id="jst.seam">
+ <label>
+ Seam
+ </label>
<description>
- Enables the project to work with JBoss Seam
- </description>
- </project-facet>
- <project-facet-version
- facet="jst.seam"
- version="1.2">
- <constraint>
- <and>
- <requires
- facet="jst.web"
- version="[2.4">
- </requires>
- <requires
- facet="jst.jsf"
- version="[1.2">
- </requires>
- <requires
- facet="jst.java"
- version="[5.0">
- </requires>
- </and>
- </constraint>
- </project-facet-version>
- <!--<project-facet-version
+ Enables the project to work with JBoss Seam
+ </description>
+ </project-facet>
+ <project-facet-version
facet="jst.seam"
+ version="1.2">
+ <constraint>
+ <and>
+ <requires
+ facet="jst.web"
+ version="[2.4">
+ </requires>
+ <requires
+ facet="jst.jsf"
+ version="[1.2">
+ </requires>
+ <requires
+ facet="jst.java"
+ version="[5.0">
+ </requires>
+ </and>
+ </constraint>
+ </project-facet-version>
+ <project-facet-version
+ facet="jst.seam"
version="2.0">
<constraint>
<and>
@@ -84,20 +84,19 @@
</requires>
</and>
</constraint>
- </project-facet-version>-->
- <action
- facet="jst.seam"
- id="jst.seam.1.2.install"
- type="install"
- version="1.2">
- <delegate
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegate">
- </delegate>
- <config-factory
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider">
- </config-factory>
+ </project-facet-version>
+ <action
+ facet="jst.seam"
+ id="jst.seam.1.2.install"
+ type="install"
+ version="1.2">
+ <delegate
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegate">
+ </delegate>
+ <config-factory
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider">
+ </config-factory>
</action>
- <!--
<action
facet="jst.seam"
id="jst.seam.2.0.install"
@@ -109,154 +108,189 @@
<config-factory
class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider">
</config-factory>
- </action> -->
- <action
- facet="jst.seam"
- id="jst.seam.1.2.uninstall"
- type="uninstall"
- version="1.2">
- <delegate
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetUninstallDelegate">
- </delegate>
- </action>
- <event-handler
- facet="jst.seam"
- type="POST_INSTALL"
- version="[1.2">
- <delegate
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPostInstallDelegate">
- </delegate>
- </event-handler>
- <event-handler
- facet="jst.seam"
- type="PRE_INSTALL"
- version="[1.2">
- <delegate
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreInstallDelegate">
- </delegate>
- </event-handler>
- <template
- id="template.jst.seam">
- <label>
- Seam Web Project
- </label>
- <fixed
- facet="jst.java"/>
- <fixed
- facet="jst.web"/>
- <fixed
- facet="jst.seam"/>
- <fixed
- facet="jst.jsf"/>
- <preset
- id="jst.seam.preset">
- </preset>
- </template>
- <preset
- id="jst.seam.preset">
- <label>
- Dynamic Web Project with Seam 1.2
- </label>
- <facet
- id="jst.java"
- version="5.0"/>
- <facet
- id="jst.web"
- version="2.5"/>
- <facet
- id="jst.jsf"
- version="1.2"/>
- <facet
- id="jst.seam"
- version="1.2"/>
- </preset>
- </extension>
- <extension
- point="org.eclipse.wst.common.project.facet.core.runtimes">
- <supported>
- <runtime-component
- id="org.jboss.ide.eclipse.as.runtime.component"
- version="4.0">
- </runtime-component>
- <runtime-component
- id="org.jboss.ide.eclipse.as.runtime.component"
- version="4.2">
- </runtime-component>
- <facet
- id="jst.seam"
- version="1.2">
- </facet>
- </supported>
- </extension>
-
- <extension
- point="org.eclipse.wst.validation.validator"
- id="SeamValidator"
- name="Seam Validator">
- <validator>
- <projectNature id="org.jboss.tools.seam.core.seamnature" />
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.java"/>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.xml"/>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.xhtml"/>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.jsp">
- </filter>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.jspf">
- </filter>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.jsf">
- </filter>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.jsv">
- </filter>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.jtpl">
- </filter>
- <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspsource"/>
- <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspfragmentsource"/>
- <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.tagsource"/>
- <markerId
- markerIdValue="seamProblem">
- </markerId>
- <helper
- class="org.jboss.tools.seam.internal.core.validation.SeamValidationHelper">
- </helper>
- <run
- class="org.jboss.tools.seam.internal.core.validation.SeamValidatorManager"
- incremental="true"
- fullBuild="true"
- />
- <dependentValidator
- depValValue="true">
- </dependentValidator>
- </validator>
- </extension>
-
- <extension
- id="seamProblem"
- name="Seam Problem"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.wst.validation.problemmarker"/>
- <persistent
- value="true">
- </persistent>
- </extension>
-
- <extension point="org.jboss.tools.common.model.classes">
- <xclass id="org.jboss.tools.seam.internal.core.el.SeamPromptingProvider"
- class="org.jboss.tools.seam.internal.core.el.SeamPromptingProvider"/>
- </extension>
-
-</plugin>
+ </action>
+ <action
+ facet="jst.seam"
+ id="jst.seam.1.2.uninstall"
+ type="uninstall"
+ version="1.2">
+ <delegate
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetUninstallDelegate">
+ </delegate>
+ </action>
+ <event-handler
+ facet="jst.seam"
+ type="POST_INSTALL"
+ version="[1.2">
+ <delegate
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPostInstallDelegate">
+ </delegate>
+ </event-handler>
+ <event-handler
+ facet="jst.seam"
+ type="PRE_INSTALL"
+ version="[1.2">
+ <delegate
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreInstallDelegate">
+ </delegate>
+ </event-handler>
+ <template
+ id="template.jst.seam">
+ <label>
+ Seam Web Project
+ </label>
+ <fixed
+ facet="jst.java"/>
+ <fixed
+ facet="jst.web"/>
+ <fixed
+ facet="jst.seam"/>
+ <fixed
+ facet="jst.jsf"/>
+ <preset
+ id="jst.seam.preset">
+ </preset>
+ </template>
+ <preset
+ id="jst.seam.preset">
+ <label>
+ Dynamic Web Project with Seam 1.2
+ </label>
+ <facet
+ id="jst.java"
+ version="5.0"/>
+ <facet
+ id="jst.web"
+ version="2.5"/>
+ <facet
+ id="jst.jsf"
+ version="1.2"/>
+ <facet
+ id="jst.seam"
+ version="1.2"/>
+ </preset>
+ <template
+ id="template.jst.seam2">
+ <label>
+ Seam 2 Web Project
+ </label>
+ <fixed
+ facet="jst.java"/>
+ <fixed
+ facet="jst.web"/>
+ <fixed
+ facet="jst.seam"/>
+ <fixed
+ facet="jst.jsf"/>
+ <preset
+ id="jst.seam2.preset">
+ </preset>
+ </template>
+ <preset
+ id="jst.seam2.preset">
+ <label>
+ Dynamic Web Project with Seam 2.0 (technology preview)
+ </label>
+ <facet
+ id="jst.java"
+ version="5.0"/>
+ <facet
+ id="jst.web"
+ version="2.5"/>
+ <facet
+ id="jst.jsf"
+ version="1.2"/>
+ <facet
+ id="jst.seam"
+ version="2.0"/>
+ </preset>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <supported>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component"
+ version="4.0">
+ </runtime-component>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component"
+ version="4.2">
+ </runtime-component>
+ <facet
+ id="jst.seam"
+ version="[1.2">
+ </facet>
+ </supported>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.validation.validator"
+ id="SeamValidator"
+ name="Seam Validator">
+ <validator>
+ <projectNature id="org.jboss.tools.seam.core.seamnature" />
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.java"/>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.xml"/>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.xhtml"/>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jsp">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jspf">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jsf">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jsv">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jtpl">
+ </filter>
+ <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspsource"/>
+ <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspfragmentsource"/>
+ <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.tagsource"/>
+ <markerId
+ markerIdValue="seamProblem">
+ </markerId>
+ <helper
+ class="org.jboss.tools.seam.internal.core.validation.SeamValidationHelper">
+ </helper>
+ <run
+ class="org.jboss.tools.seam.internal.core.validation.SeamValidatorManager"
+ incremental="true"
+ fullBuild="true"
+ />
+ <dependentValidator
+ depValValue="true">
+ </dependentValidator>
+ </validator>
+ </extension>
+
+ <extension
+ id="seamProblem"
+ name="Seam Problem"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.wst.validation.problemmarker"/>
+ <persistent
+ value="true">
+ </persistent>
+ </extension>
+
+ <extension point="org.jboss.tools.common.model.classes">
+ <xclass id="org.jboss.tools.seam.internal.core.el.SeamPromptingProvider"
+ class="org.jboss.tools.seam.internal.core.el.SeamPromptingProvider"/>
+ </extension>
+
+</plugin>
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -1,87 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2007 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.seam.internal.core.project.facet;
-
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-/**
- * Seam facet properties
- * @author eskimo
- *
- */
-public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
-
- public static final String SEAM_PROJECT_NAME = "project.name"; //$NON-NLS-1$
-
- public static final String SEAM_PROJECT_INSTANCE = "seam.project.instance"; //$NON-NLS-1$
-
- public static final String SEAM_CONNECTION_PROFILE = "seam.project.connection.profile"; //$NON-NLS-1$
-
- public static final String SEAM_RUNTIME_NAME = "seam.runtime.name"; //$NON-NLS-1$
-
- public static final String JBOSS_AS_HOME = "jboss.home"; //$NON-NLS-1$
-
- public static final String JBOSS_AS_DEPLOY_AS = "seam.project.deployment.type"; //$NON-NLS-1$
-
- public static final String DB_TYPE = "database.type"; //$NON-NLS-1$
-
- public static final String HIBERNATE_DIALECT = "hibernate.dialect"; //$NON-NLS-1$
-
- public static final String JDBC_DRIVER_CLASS_NAME = "hibernate.connection.driver_class"; //$NON-NLS-1$
-
- public static final String JDBC_URL_FOR_DB = "hibernate.connection.url"; //$NON-NLS-1$
-
- public static final String DB_USER_NAME = "hibernate.connection.username"; //$NON-NLS-1$
-
- public static final String DB_USER_PASSWORD = "hibernate.connection.password"; //$NON-NLS-1$
-
- public static final String DB_SCHEMA_NAME = "schema.property"; //$NON-NLS-1$
-
- public static final String DB_CATALOG_NAME = "catalog.property"; //$NON-NLS-1$
-
- public static final String DB_ALREADY_EXISTS = "database.exists"; //$NON-NLS-1$
-
- public static final String RECREATE_TABLES_AND_DATA_ON_DEPLOY = "database.drop"; //$NON-NLS-1$
-
- public static final String HIBERNATE_HBM2DDL_AUTO = "hibernate.hbm2ddl.auto"; //$NON-NLS-1$
-
- public static final String JDBC_DRIVER_JAR_PATH = "driver.file"; //$NON-NLS-1$
-
- public static final String SESION_BEAN_PACKAGE_NAME = "action.package"; //$NON-NLS-1$
-
- public static final String SESION_BEAN_PACKAGE_PATH = "action.package.path"; //$NON-NLS-1$
-
- public static final String ENTITY_BEAN_PACKAGE_NAME = "model.package"; //$NON-NLS-1$
-
- public static final String ENTITY_BEAN_PACKAGE_PATH = "model.package.path"; //$NON-NLS-1$
-
- public static final String TEST_CASES_PACKAGE_NAME = "test.package"; //$NON-NLS-1$
-
- public static final String TEST_CASES_PACKAGE_PATH = "test.package.path"; //$NON-NLS-1$
-
- public static final String JBOSS_SEAM_HOME = "seam.home.folder"; //$NON-NLS-1$
-
- public static final String WEB_CONTENTS_FOLDER = "seam.project.web.root.folder"; //$NON-NLS-1$
-
- public static final String SEAM_EJB_PROJECT = "seam.ejb.project"; //$NON-NLS-1$
-
- public static final String SEAM_TEST_PROJECT = "seam.test.project"; //$NON-NLS-1$
-
- public static final String SEAM_EAR_PROJECT = "seam.ear.project"; //$NON-NLS-1$
-
- public static final String DEPLOY_AS_WAR = "war"; //$NON-NLS-1$
-
- public static final String DEPLOY_AS_EAR = "ear"; //$NON-NLS-1$
-
- public static final String JBOSS_AS_TARGET_SERVER = "seam.project.deployment.target"; //$NON-NLS-1$
- public static final String JBOSS_AS_TARGET_RUNTIME = "seam.project.deployment.runtime"; //$NON-NLS-1$
-}
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+/**
+ * Seam facet properties
+ * @author eskimo
+ *
+ */
+public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
+
+ public static final String SEAM_PROJECT_NAME = "project.name"; //$NON-NLS-1$
+
+ public static final String SEAM_PROJECT_INSTANCE = "seam.project.instance"; //$NON-NLS-1$
+
+ public static final String SEAM_CONNECTION_PROFILE = "seam.project.connection.profile"; //$NON-NLS-1$
+
+ public static final String SEAM_RUNTIME_NAME = "seam.runtime.name"; //$NON-NLS-1$
+
+ public static final String JBOSS_AS_HOME = "jboss.home"; //$NON-NLS-1$
+
+ public static final String JBOSS_AS_DEPLOY_AS = "seam.project.deployment.type"; //$NON-NLS-1$
+
+ public static final String DB_TYPE = "database.type"; //$NON-NLS-1$
+
+ public static final String HIBERNATE_DIALECT = "hibernate.dialect"; //$NON-NLS-1$
+
+ public static final String JDBC_DRIVER_CLASS_NAME = "hibernate.connection.driver_class"; //$NON-NLS-1$
+
+ public static final String JDBC_URL_FOR_DB = "hibernate.connection.url"; //$NON-NLS-1$
+
+ public static final String DB_USER_NAME = "hibernate.connection.username"; //$NON-NLS-1$
+
+ public static final String DB_USER_PASSWORD = "hibernate.connection.password"; //$NON-NLS-1$
+
+ public static final String DB_SCHEMA_NAME = "schema.property"; //$NON-NLS-1$
+
+ public static final String DB_CATALOG_NAME = "catalog.property"; //$NON-NLS-1$
+
+ public static final String DB_ALREADY_EXISTS = "database.exists"; //$NON-NLS-1$
+
+ public static final String RECREATE_TABLES_AND_DATA_ON_DEPLOY = "database.drop"; //$NON-NLS-1$
+
+ public static final String HIBERNATE_HBM2DDL_AUTO = "hibernate.hbm2ddl.auto"; //$NON-NLS-1$
+
+ public static final String JDBC_DRIVER_JAR_PATH = "driver.file"; //$NON-NLS-1$
+
+ public static final String SESION_BEAN_PACKAGE_NAME = "action.package"; //$NON-NLS-1$
+
+ // why is this a property when it is always derivable from sesion_bean_package_name ?
+ public static final String SESION_BEAN_PACKAGE_PATH = "action.package.path"; //$NON-NLS-1$
+
+ public static final String ENTITY_BEAN_PACKAGE_NAME = "model.package"; //$NON-NLS-1$
+
+ // why is this a property when it is always derivable from entity_bean_package_name ?
+ public static final String ENTITY_BEAN_PACKAGE_PATH = "model.package.path"; //$NON-NLS-1$
+
+ public static final String TEST_CASES_PACKAGE_NAME = "test.package"; //$NON-NLS-1$
+
+ // why is this a property when it is always derivable from test_package_path ?
+ public static final String TEST_CASES_PACKAGE_PATH = "test.package.path"; //$NON-NLS-1$
+
+ public static final String JBOSS_SEAM_HOME = "seam.home.folder"; //$NON-NLS-1$
+
+ public static final String WEB_CONTENTS_FOLDER = "seam.project.web.root.folder"; //$NON-NLS-1$
+
+ public static final String SEAM_EJB_PROJECT = "seam.ejb.project"; //$NON-NLS-1$
+
+ public static final String SEAM_TEST_PROJECT = "seam.test.project"; //$NON-NLS-1$
+
+ public static final String SEAM_EAR_PROJECT = "seam.ear.project"; //$NON-NLS-1$
+
+ public static final String DEPLOY_AS_WAR = "war"; //$NON-NLS-1$
+
+ public static final String DEPLOY_AS_EAR = "ear"; //$NON-NLS-1$
+
+ public static final String JBOSS_AS_TARGET_SERVER = "seam.project.deployment.target"; //$NON-NLS-1$
+ public static final String JBOSS_AS_TARGET_RUNTIME = "seam.project.deployment.runtime"; //$NON-NLS-1$
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -0,0 +1,676 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+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.eclipse.wst.common.uriresolver.internal.URI;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.ResourcesUtils;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.osgi.service.prefs.BackingStoreException;
+
+// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it in our unittests!
+public class Seam2FacetInstallDelegate extends Object implements IDelegate,ISeamFacetDataModelProperties {
+
+ public static String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
+ public static String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
+ public static String TEST_WAR_PROFILE = "test-war"; //$NON-NLS-1$
+ public static String TEST_EAR_PROFILE = "test"; //$NON-NLS-1$
+
+
+ public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
+ .include("ajax4jsf.*\\.jar") //$NON-NLS-1$
+ .include("richfaces.*\\.jar")
+ .include("antlr.*\\.jar") //$NON-NLS-1$
+ .include("commons-beanutils.*\\.jar") //$NON-NLS-1$
+ .include("commons-collections.*\\.jar") //$NON-NLS-1$
+ .include("commons-digester.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("janino.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-debug\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ioc\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-mail\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-pdf\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-remoting\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ui\\.jar") //$NON-NLS-1$
+ .include("jboss-seam\\.jar") //$NON-NLS-1$
+ .include("jbpm.*\\.jar") //$NON-NLS-1$
+ .include("jsf-facelets\\.jar") //$NON-NLS-1$
+ .include("oscache.*\\.jar") //$NON-NLS-1$
+ .include("stringtemplate.*\\.jar") //$NON-NLS-1$
+ .include("mvel14.jar") //$NON-NLS-1$
+ .include("jboss-el.jar"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
+ .include("testng-.*-jdk15\\.jar") //$NON-NLS-1$
+ .include("myfaces-api-.*\\.jar") //$NON-NLS-1$
+ .include("myfaces-impl-.*\\.jar") //$NON-NLS-1$
+ .include("servlet-api\\.jar") //$NON-NLS-1$
+ .include("hibernate-all\\.jar") //$NON-NLS-1$
+ .include("jboss-ejb3-all\\.jar") //$NON-NLS-1$
+ .include("thirdparty-all\\.jar") //$NON-NLS-1$
+ .include("el-api\\.jar") //$NON-NLS-1$
+ .include("el-ri\\.jar") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
+ .include("ajax4jsf.*\\.jar") //$NON-NLS-1$
+ .include("richfaces.*\\.jar") //$NON-NLS-1$
+ .include("commons-beanutils.*\\.jar") //$NON-NLS-1$
+ .include("commons-digester.*\\.jar") //$NON-NLS-1$
+ .include("commons-collections.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-debug\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ioc\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-mail\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-pdf\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-remoting\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ui\\.jar") //$NON-NLS-1$
+ .include("jsf-facelets\\.jar") //$NON-NLS-1$
+ .include("oscache.*\\.jar"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr.*\\.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam.jar") //$NON-NLS-1$
+ .include("jboss-el.*.jar") //$NON-NLS-1$
+ .include("mvel14.*.jar") //$NON-NLS-1$
+ .include("jbpm-jpdl.*\\.jar") //$NON-NLS-1$
+ .include("richfaces-api.*\\.jar") //$NON-NLS-1$
+ .include("security\\.drl"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
+ .include("META-INF/application\\.xml") //$NON-NLS-1$
+ .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
+ .include("home\\.xhtml") //$NON-NLS-1$
+ .include("error\\.xhtml") //$NON-NLS-1$
+ .include("login\\.xhtml") //$NON-NLS-1$
+ .include("login\\.page.xml") //$NON-NLS-1$
+ .include("index\\.html") //$NON-NLS-1$
+ .include("layout") //$NON-NLS-1$
+ .include("layout/.*") //$NON-NLS-1$
+ .include("stylesheet") //$NON-NLS-1$
+ .include("stylesheet/.*") //$NON-NLS-1$
+ .include("img/.*") //$NON-NLS-1$
+ .include("img") //$NON-NLS-1$
+ .exclude(".*/.*\\.ftl") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet CVS_SVN = new AntCopyUtils.FileSet()
+ .include(".*") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude("CVS") //$NON-NLS-1$
+ .exclude(".*\\.svn") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
+ .include("WEB-INF") //$NON-NLS-1$
+ .include("WEB-INF/web\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/pages\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/jboss-web\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/faces-config\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/componets\\.xml"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
+ .include("import\\.sql") //$NON-NLS-1$
+ .include("security\\.drl") //$NON-NLS-1$
+ .include("seam\\.properties") //$NON-NLS-1$
+ .include("messages_en\\.properties"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
+ .include("import\\.sql") //$NON-NLS-1$
+ .include("seam\\.properties")
+ .exclude(".*/WEB-INF"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_META_INF_SET = new AntCopyUtils.FileSet()
+ .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
+
+ public static String DROOLS_LIB_SEAM_RELATED_PATH = "lib"; //$NON-NLS-1$
+
+ public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
+
+ public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib"; //$NON-NLS-1$
+
+ public void execute(final IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ final IDataModel model = (IDataModel)config;
+
+ // get WebContents folder path from DWP model
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ final IVirtualFolder srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")); //$NON-NLS-1$
+ IContainer webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, project.getName()+"-test"); //$NON-NLS-1$
+
+ Boolean dbExists = (Boolean)model.getProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
+ Boolean dbRecreate = (Boolean)model.getProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
+ if(!dbExists && !dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"update"); //$NON-NLS-1$
+ } else if(dbExists && !dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"validate"); //$NON-NLS-1$
+ } else if(dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"create-drop"); //$NON-NLS-1$
+ }
+
+ final File webContentFolder = webRootFolder.getLocation().toFile();
+ final File webInfFolder = new File(webContentFolder,"WEB-INF"); //$NON-NLS-1$
+ final File webInfClasses = new File(webInfFolder,"classes"); //$NON-NLS-1$
+ final File webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
+ webInfClassesMetaInf.mkdirs();
+ final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
+ final File srcFolder = isWarConfiguration(model)?new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(),"model"):srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
+ final File webMetaInf = new File(webContentFolder, "META-INF"); //$NON-NLS-1$
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
+
+ final String seamHomePath = selectedRuntime.getHomeDir();
+
+ final File seamHomeFolder = new File(seamHomePath);
+ final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
+ final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources"); //$NON-NLS-1$
+ final File seamGenResMetainfFolder = new File(seamGenResFolder,"META-INF"); //$NON-NLS-1$
+
+ final File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
+ final File seamGenHomeFolder = new File(seamHomePath,"seam-gen"); //$NON-NLS-1$
+ final File seamGenViewSource = new File(seamGenHomeFolder,"view"); //$NON-NLS-1$
+ final File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
+ final File componentsFile = new File(seamGenResFolder,"WEB-INF/components"+(isWarConfiguration(model)?"-war":"")+".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
+ final File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
+ final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
+ final File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + (isWarConfiguration(model)?DEV_WAR_PROFILE:DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ final File applicationFile = new File(seamGenResFolder,"META-INF/application.xml"); //$NON-NLS-1$
+
+ final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+ final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+
+ // ****************************************************************
+ // Copy view folder from seam-gen installation to WebContent folder
+ // ****************************************************************
+ final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
+ final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
+ viewFilterSetCollection.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenViewSource,
+ webContentFolder,
+ new AntCopyUtils.FileSetFileFilter(viewFileSet),
+ viewFilterSetCollection,
+ true);
+
+ // *******************************************************************
+ // Copy manifest and configuration resources the same way as view
+ // *******************************************************************
+ AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
+
+ AntCopyUtils.copyFileToFile(
+ componentsFile,
+ new File(webInfFolder,"components.xml"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,webContentFolder,new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
+
+
+ final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
+ hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
+ hibernateDialectFilterSet.addFilterSet(projectFilterSet);
+ hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
+
+ createTestProject(model,project,selectedRuntime);
+
+ // ********************************************************************************************
+ // Handle WAR/EAR configurations
+ // ********************************************************************************************
+ if(isWarConfiguration(model)) {
+
+ AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,srcFolder,new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
+
+ createComponentsProperties(srcFolder, isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ // In case of WAR configuration
+ AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
+
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), srcFolder, true); //$NON-NLS-1$
+ final IContainer source = srcRootFolder.getUnderlyingFolder();
+
+ IPath actionSrcPath = new Path(source.getFullPath().lastSegment()+"/action"); //$NON-NLS-1$
+ IPath modelSrcPath = new Path(source.getFullPath().lastSegment()+"/model"); //$NON-NLS-1$
+
+ srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
+ WtpUtils.createSourceFolder(project, actionSrcPath, new Path(source.getFullPath().lastSegment()), new Path(webRootFolder.getLocation().lastSegment()+"/WEB-INF/dev")); //$NON-NLS-1$
+ WtpUtils.createSourceFolder(project, modelSrcPath, new Path(source.getFullPath().lastSegment()), null);
+
+ srcRootFolder.createLink(actionSrcPath, 0, null);
+ srcRootFolder.createLink(modelSrcPath, 0, null);
+
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
+ new File(project.getLocation().toFile(),source.getFullPath().lastSegment()+"/action/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), true);
+
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(srcFolder,project.getName()+"-ds.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(project.getLocation().toFile(),project.getName()+".launch"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ project.getLocation().toFile(),
+ hibernateDialectFilterSet, true);
+
+ WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
+
+ Job create = new DataSourceXmlDeployer(project);
+ create.setUser(true);
+ create.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ create.schedule();
+
+ } else {
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, project.getName()+"-ejb"); //$NON-NLS-1$
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, project.getName()+"-ear"); //$NON-NLS-1$
+
+ // In case of EAR configuration
+ AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"messages_en.properties"),srcFolder, true); //$NON-NLS-1$
+
+ File ear = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear"); //$NON-NLS-1$
+ File ejb = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb"); //$NON-NLS-1$
+ ear.mkdir();
+ ejb.mkdir();
+
+ try {
+ FilterSet filterSet = new FilterSet();
+ filterSet.addFilter("projectName", project.getName()); //$NON-NLS-1$
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project)); //$NON-NLS-1$
+ if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null) {
+ File driver = new File(((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ filterSet.addFilter("driverJar"," " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ filterSet.addFilter("driverJar",""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ AntCopyUtils.FileSet excludeCvsSvn = new AntCopyUtils.FileSet(CVS_SVN).dir(seamGenResFolder);
+
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb"), //$NON-NLS-1$
+ ejb, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ // *******************************************************************************************
+ // Copy sources to ejb project in case of EAR configuration
+ // *******************************************************************************************
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
+ new File(ejb,"ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), true);
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(ejb,"ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ createComponentsProperties(new File(ejb,"ejbModule"), isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,new File(ejb,"ejbModule"),new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, true); //$NON-NLS-1$
+
+
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), new File(ejb,"ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(ejb,"ejbModule/"+project.getName()+"-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder,"META-INF/ejb-jar.xml"), //$NON-NLS-1$
+ new File(ejb,"ejbModule/META-INF/"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(ejb,".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ FilterSet ejbFilterSet = new FilterSet();
+ ejbFilterSet.addFilter("projectName",ejb.getName()); //$NON-NLS-1$
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(ejb,ejb.getName()+".launch"), //$NON-NLS-1$
+ new FilterSetCollection(ejbFilterSet), true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ ejb,
+ hibernateDialectFilterSet, true);
+
+ File earContentsFolder = new File(ear,"EarContent"); //$NON-NLS-1$
+
+ FilterSet earFilterSet = new FilterSet();
+ earFilterSet.addFilter("projectName",ear.getName()+".ear"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /* jboss-app.xml not needed anymore AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder,"META-INF/jboss-app.xml"), //$NON-NLS-1$
+ new File(earContentsFolder,"META-INF"), //$NON-NLS-1$
+ new FilterSetCollection(earFilterSet),true);*/
+
+ // Copy configuration files from template
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ear-seam2"), //$NON-NLS-1$
+ ear, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ // Fill ear contents
+ AntCopyUtils.copyFiles(seamHomeFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
+
+ try {
+
+ File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
+ /* (non-Javadoc)
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ public boolean accept(File dir, String name) {
+ if(name.lastIndexOf(".jar")>0) return true; //$NON-NLS-1$
+ return false;
+ }
+ });
+ String earJarsStr = ""; //$NON-NLS-1$
+ for (File file : earJars) {
+ earJarsStr +=" " + file.getName() +" \n"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ FilterSetCollection manifestFilterCol = new FilterSetCollection(projectFilterSet);
+ FilterSet manifestFilter = new FilterSet();
+ manifestFilter.addFilter("earLibs",earJarsStr); //$NON-NLS-1$
+ manifestFilterCol.addFilterSet(manifestFilter);
+ AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterCol, true); //$NON-NLS-1$
+ File ejbMetaInf = new File(ejb,"ejbModule/META-INF"); //$NON-NLS-1$
+ AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterCol, true); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ ClasspathHelper.addClasspathEntries(project, fv);
+
+ createSeamProjectPreferenes(project, model);
+
+
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ String wsPath = project.getLocation().removeLastSegments(1)
+ .toFile().getAbsoluteFile().getPath();
+
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ if(!isWarConfiguration(model)) {
+
+ IProject ejbProjectToBeImported = wsRoot.getProject(project.getName()+"-ejb");
+ ResourcesUtils.importExistingProject(ejbProjectToBeImported, wsPath+"/"+project.getName()+"-ejb", project.getName()+"-ejb");
+
+ IProject earProjectToBeImported = wsRoot.getProject(project.getName()+"-ear");
+ ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath+"/"+project.getName()+"-ear", project.getName()+"-ear");
+ }
+
+ IProject testProjectToBeImported = wsRoot.getProject(project.getName()+"-test");
+ ResourcesUtils.importExistingProject(testProjectToBeImported, wsPath+"/"+project.getName()+"-test", project.getName()+"-test");
+
+ }
+
+
+
+ public static boolean isWarConfiguration(IDataModel model) {
+ return "war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)); //$NON-NLS-1$
+ }
+
+
+ /**
+ * @param project
+ * @param model
+ */
+ private void createSeamProjectPreferenes(final IProject project,
+ final IDataModel model) {
+ IScopeContext projectScope = new ProjectScope(project);
+ IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
+
+ prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
+
+ prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
+
+ prefs.put(SEAM_CONNECTION_PROFILE,model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+
+ prefs.put(SESION_BEAN_PACKAGE_NAME, model.getProperty(SESION_BEAN_PACKAGE_NAME).toString());
+
+ prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
+
+ prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
+
+ prefs.put(SEAM_TEST_PROJECT,
+ model.getProperty(SEAM_TEST_PROJECT)==null?
+ "":model.getProperty(SEAM_TEST_PROJECT).toString()); //$NON-NLS-1$
+
+ if(DEPLOY_AS_EAR.equals(model.getProperty(JBOSS_AS_DEPLOY_AS))) {
+ prefs.put(SEAM_EJB_PROJECT,
+ model.getProperty(SEAM_EJB_PROJECT)==null?
+ "":model.getProperty(SEAM_EJB_PROJECT).toString()); //$NON-NLS-1$
+
+ prefs.put(SEAM_EAR_PROJECT,
+ model.getProperty(SEAM_EAR_PROJECT)==null?
+ "":model.getProperty(SEAM_EAR_PROJECT).toString()); //$NON-NLS-1$
+ }
+
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ private void createTestProject(IDataModel model, IProject seamWebProject, SeamRuntime seamRuntime) {
+ String projectName = model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME).toString();
+ File testProjectDir = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(),projectName+"-test"); //$NON-NLS-1$
+ testProjectDir.mkdir();
+
+ IVirtualComponent component = ComponentCore.createComponent(seamWebProject);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+
+ File testLibDir = new File(testProjectDir,"lib"); //$NON-NLS-1$
+ File embededEjbDir = new File(testProjectDir,"bootstrap"); //$NON-NLS-1$
+ File testSrcDir = new File(testProjectDir,"test-src"); //$NON-NLS-1$
+ String seamGenResFolder = seamRuntime.getResourceTemplatesDir();
+ File persistenceFile = new File(seamGenResFolder ,"META-INF/persistence-" + (isWarConfiguration(model)?TEST_WAR_PROFILE:TEST_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+ File jbossBeansFile = new File(seamGenResFolder ,"META-INF/jboss-beans.xml"); //$NON-NLS-1$
+ FilterSet filterSet = new FilterSet();
+ filterSet.addFilter("projectName", projectName); //$NON-NLS-1$
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
+ filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getLocation().lastSegment()); //$NON-NLS-1$
+
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
+ final String seamHomePath = selectedRuntime.getHomeDir();
+
+ AntCopyUtils.FileSet includeLibs
+ = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
+ .dir(new File(seamRuntime.getHomeDir(),"lib")); //$NON-NLS-1$
+ File[] libs = includeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(includeLibs));
+ StringBuffer testLibraries = new StringBuffer();
+
+ for (File file : libs) {
+ testLibraries.append("\t<classpathentry kind=\"lib\" path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ StringBuffer requiredProjects = new StringBuffer();
+ requiredProjects.append(
+ "\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ if(!isWarConfiguration(model)) {
+ requiredProjects.append(
+ "\n\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "-ejb\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ filterSet.addFilter("testLibraries",testLibraries.toString()); //$NON-NLS-1$
+ filterSet.addFilter("requiredProjects",requiredProjects.toString()); //$NON-NLS-1$
+ File testTemplateDir = null;
+ try {
+ testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"test"); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+ AntCopyUtils.FileSet excludeCvsSvn
+ = new AntCopyUtils.FileSet(CVS_SVN).dir(testTemplateDir);
+
+ AntCopyUtils.copyFilesAndFolders(
+ testTemplateDir,
+ testProjectDir,
+ new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ excludeCvsSvn.dir(new File(seamRuntime.getHomeDir(),"bootstrap")); //$NON-NLS-1$
+ AntCopyUtils.copyFilesAndFolders(
+ new File(seamRuntime.getHomeDir(),"bootstrap"), //$NON-NLS-1$
+ embededEjbDir,
+ new AntCopyUtils.FileSetFileFilter(excludeCvsSvn), new FilterSetCollection(), true);
+
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(testProjectDir,"test-src/META-INF/persistence.xml"), //$NON-NLS-1$
+ new FilterSetCollection(filterSet), true);
+
+ AntCopyUtils.copyFileToFolder(
+ jbossBeansFile,
+ new File(testProjectDir,"test-src/META-INF"), //$NON-NLS-1$
+ new FilterSetCollection(filterSet), true);
+
+ AntCopyUtils.copyFiles(
+ new File(seamRuntime.getHomeDir(),"lib"), //$NON-NLS-1$
+ testLibDir,
+ new AntCopyUtils.FileSetFileFilter(includeLibs));
+
+ createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
+ }
+
+ /**
+ * @param seamGenResFolder
+ */
+ private void createComponentsProperties(final File seamGenResFolder, String projectName, Boolean embedded) {
+ Properties components = new Properties();
+ String prefix = "".equals(projectName)?"":projectName+"/"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ components.put("embeddedEjb", embedded.toString()); //$NON-NLS-1$
+ components.put("jndiPattern", prefix+"#{ejbName}/local"); //$NON-NLS-1$ //$NON-NLS-2$
+ File componentsProps = new File(seamGenResFolder,"components.properties"); //$NON-NLS-1$
+ try {
+ componentsProps.createNewFile();
+ components.store(new FileOutputStream(componentsProps), ""); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.common.project.facet.core.IActionConfigFactory#create()
+ */
+ public Object create() throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -42,7 +42,9 @@
PROJECT_TEMPLATE.addFilter("hbm2ddl","${hibernate.hbm2ddl.auto}"); //$NON-NLS-1$ //$NON-NLS-2$
PROJECT_TEMPLATE.addFilter("driverJar","${driver.file}"); //$NON-NLS-1$ //$NON-NLS-2$
PROJECT_TEMPLATE.addFilter("debug","true"); //$NON-NLS-1$ //$NON-NLS-2$
-
+ //todo: keep this local for seam2 ?
+ PROJECT_TEMPLATE.addFilter("skin","blueSky"); //$NON-NLS-1$ //$NON-NLS-2$
+
FILTERS_TEMPLATE = new FilterSet();
FILTERS_TEMPLATE.addFilter("interfaceName","${interface.name}"); //$NON-NLS-1$ //$NON-NLS-2$
FILTERS_TEMPLATE.addFilter("beanName","${bean.name}"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -57,31 +59,32 @@
FILTERS_TEMPLATE.addFilter("listName","${component.name}List"); //$NON-NLS-1$ //$NON-NLS-2$
FILTERS_TEMPLATE.addFilter("homeName","${component.name}Home"); //$NON-NLS-1$ //$NON-NLS-2$
FILTERS_TEMPLATE.addFilter("query","${query.text}"); //$NON-NLS-1$ //$NON-NLS-2$
+
HIBERNATE_DIALECT_TEMPLATE = new FilterSet();
HIBERNATE_DIALECT_TEMPLATE.addFilter("hibernate.dialect","${hibernate.dialect}"); //$NON-NLS-1$ //$NON-NLS-2$
}
public static FilterSet createJdbcFilterSet(IDataModel values) {
- return aplayProperties((FilterSet)JDBC_TEMPLATE.clone(), values);
+ return applyProperties((FilterSet)JDBC_TEMPLATE.clone(), values);
}
public static FilterSet createProjectFilterSet(IDataModel values){
- return aplayProperties((FilterSet)PROJECT_TEMPLATE.clone(), values);
+ return applyProperties((FilterSet)PROJECT_TEMPLATE.clone(), values);
}
public static FilterSet createFiltersFilterSet(IDataModel values) {
- return aplayProperties((FilterSet)FILTERS_TEMPLATE.clone(), values);
+ return applyProperties((FilterSet)FILTERS_TEMPLATE.clone(), values);
}
public static FilterSet createHibernateDialectFilterSet(IDataModel values) {
- return aplayProperties((FilterSet)HIBERNATE_DIALECT_TEMPLATE.clone(), values);
+ return applyProperties((FilterSet)HIBERNATE_DIALECT_TEMPLATE.clone(), values);
}
public static FilterSet createFiltersFilterSet(Map values) {
- return aplayProperties((FilterSet)FILTERS_TEMPLATE.clone(), values);
+ return applyProperties((FilterSet)FILTERS_TEMPLATE.clone(), values);
}
- private static FilterSet aplayProperties(FilterSet template,IDataModel values) {
+ private static FilterSet applyProperties(FilterSet template,IDataModel values) {
FilterSet result = new FilterSet();
for (Object filter : template.getFilterHash().keySet()) {
String value = template.getFilterHash().get(filter).toString();
@@ -96,7 +99,7 @@
return result;
}
- private static FilterSet aplayProperties(FilterSet template,Map values) {
+ private static FilterSet applyProperties(FilterSet template,Map values) {
FilterSet result = new FilterSet();
for (Object filter : template.getFilterHash().keySet()) {
String value = template.getFilterHash().get(filter).toString();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-10-21 06:33:02 UTC (rev 4396)
@@ -96,6 +96,9 @@
point="org.eclipse.wst.common.project.facet.ui.wizardPages">
<wizard-pages action="jst.seam.1.2.install">
<page class="org.jboss.tools.seam.ui.internal.project.facet.SeamInstallWizardPage"/>
+ </wizard-pages>
+ <wizard-pages action="jst.seam.2.0.install">
+ <page class="org.jboss.tools.seam.ui.internal.project.facet.SeamInstallWizardPage"/>
</wizard-pages>
</extension>
<extension
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -34,6 +34,7 @@
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.ejb.provider.HomeInterfaceProviderHelper;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -283,7 +284,7 @@
}
public List<String> getRuntimeNames() {
- SeamRuntime[] rts = SeamRuntimeManager.getInstance().getRuntimes(SeamVersion.SEAM_1_2);
+ SeamRuntime[] rts = SeamRuntimeManager.getInstance().getRuntimes(/*SeamVersion.SEAM_1_2*/);
List<String> result = new ArrayList<String>();
for(SeamRuntime seamRuntime : rts) {
result.add(seamRuntime.getName());
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -38,6 +38,7 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -147,13 +148,26 @@
SeamUIMessages.VALIDATOR_FACTORY_SEAM_HOME_FOLDER_DOES_NOT_EXISTS);
return errors;
}
- File seamJarFile = new File(value.toString(), "jboss-seam.jar"); //$NON-NLS-1$
- if (!seamJarFile.isFile()) {
- errors = createErrorMap();
- errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO +
- SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
- }
+ String version = (String) context;
+
+ if(version.startsWith("2.0")) {
+ File seamJarFile = new File(value.toString(), "lib/jboss-seam.jar"); //$NON-NLS-1$
+ if (!seamJarFile.isFile()) {
+ errors = createErrorMap();
+ errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO +
+ SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
+ }
+ } else {
+ File seamJarFile = new File(value.toString(), "jboss-seam.jar"); //$NON-NLS-1$
+ if (!seamJarFile.isFile()) {
+ errors = createErrorMap();
+ errors.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ SeamUIMessages.VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO +
+ SeamUIMessages.VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER);
+ }
+ }
+
return errors;
}
};
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -319,7 +319,7 @@
IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(
"version", SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_VERSION2, Arrays.asList( //$NON-NLS-1$
- new Object[]{SeamVersion.SEAM_1_2.toString()}),
+ new String[]{SeamVersion.SEAM_1_2.toString(), SeamVersion.SEAM_2_0.toString()}),
SeamVersion.SEAM_1_2.toString(), false);
IFieldEditor homeDir = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
@@ -393,13 +393,6 @@
return;
}
- Map errors = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR.validate(
- homeDir.getValueAsString(), null);
- if( errors != ValidatorFactory.NO_ERRORS) {
- setErrorMessage(errors.get(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString());
- setPageComplete(false);
- return;
- }
String seamVersion = getSeamVersion(homeDir.getValueAsString());
if("".equals(seamVersion)) { //$NON-NLS-1$
setErrorMessage(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_CANNOT_OBTAIN_SEAM_VERSION_NUMBER);
@@ -411,12 +404,24 @@
return;
}
+ Map errors = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR.validate(
+ homeDir.getValueAsString(), seamVersion);
+ if( errors != ValidatorFactory.NO_ERRORS) {
+ setErrorMessage(errors.get(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString());
+ setPageComplete(false);
+ return;
+ }
+
+
setErrorMessage(null);
setPageComplete(true);
}
public static String getSeamVersion(String path) {
File seamJarFile = new File(path, "jboss-seam.jar"); //$NON-NLS-1$
+ if(!seamJarFile.exists()) {
+ seamJarFile = new File(path, "lib/jboss-seam.jar"); // hack to make it work for seam2
+ }
InputStream str=null;
ZipFile seamJar;
try {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -118,7 +118,7 @@
vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, entityFolder);
List<String[]> fileMapping = getFileMappings(vars);
- List<String[]> fileMappingCopy = applayVariables(fileMapping,vars);
+ List<String[]> fileMappingCopy = applyVariables(fileMapping,vars);
FilterSetCollection filters = getFilterSetCollection(vars);
final File[] file = new File[fileMappingCopy.size()];
int index=0;
@@ -159,7 +159,7 @@
* @param vars
* @return
*/
- public static List<String[]> applayVariables(List<String[]> fileMapping,
+ public static List<String[]> applyVariables(List<String[]> fileMapping,
Map<String, Object> vars) {
List<String[]> result = new ArrayList<String[]>();
for (String[] filter : fileMapping) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -74,8 +74,10 @@
result = operationHistory.execute(operation, monitor, (IAdaptable)getPages()[0]);
} catch (ExecutionException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
+ SeamCorePlugin.getPluginLog().logError(e);
+ ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Seam wizard error", result.getMessage(), result);
}
-// ErrorDialog.openError(Display.getCurrent().getActiveShell(), SeamUIMessages.SeamBaseWizard_0, result.getMessage(), result);
+ //ErrorDialog.openError(Display.getCurrent().getActiveShell(), SeamUIMessages.SeamBaseWizard_0, result.getMessage(), result);
}
});
} catch (InvocationTargetException e) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -24,6 +24,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -31,10 +32,12 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.INewWizard;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamProjectsSet;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -214,12 +217,27 @@
// destdir="${project.home}/src"
// foreach="entity"/>
+ IEclipsePreferences seamFacetPrefs = SeamCorePlugin.getSeamPreferences(project);
+ final String actionpackage = seamFacetPrefs.get(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME, "");
+ final String actionDir = actionpackage.replace('.','/');
+
+ ISeamProject sprj = (ISeamProject)project.getNature(ISeamProject.NATURE_ID);
+ boolean seam2 = sprj.getRuntime().getVersion().equals(SeamVersion.SEAM_2_0);
+
hbmtemplateAttributes = new HashMap<String, String>();
- hbmtemplateAttributes.put("file_pattern", "{package-name}/{class-name}List.java"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if(seam2) {
+ //Seam2: <property key="actionPackage" value="${action.package}" />
+ hbmtemplateAttributes.put("actionPackage",actionpackage); //$NON-NLS-1$ //$NON-NLS-2$
+ hbmtemplateAttributes.put("file_pattern", actionDir + "/{class-name}List.java"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ hbmtemplateAttributes.put("file_pattern", "{package-name}/{class-name}List.java"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
hbmtemplateAttributes.put("template_name", "src/EntityList.java.ftl"); //$NON-NLS-1$ //$NON-NLS-2$
hbmtemplateAttributes.put("outputdir",seamProjectsSet.getActionsFolder().getFullPath().toString()); //$NON-NLS-1$
hbmtemplateAttributes.put("for_each", "entity"); //$NON-NLS-1$ //$NON-NLS-2$
hbmtemplateAttributes.put("hibernatetool.util.toolclass","org.hibernate.eclipse.launch.SeamUtil"); //$NON-NLS-1$ //$NON-NLS-2$
+
wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate6.properties", hbmtemplateAttributes); //$NON-NLS-1$
// <hbmtemplate filepattern="{class-name}List.page.xml"
@@ -242,7 +260,14 @@
// foreach="entity"/>
hbmtemplateAttributes = new HashMap<String, String>();
- hbmtemplateAttributes.put("file_pattern", "{package-name}/{class-name}Home.java"); //$NON-NLS-1$ //$NON-NLS-2$
+ if(seam2) {
+ //Seam2: <property key="actionPackage" value="${action.package}" />
+ hbmtemplateAttributes.put("actionPackage",actionpackage); //$NON-NLS-1$ //$NON-NLS-2$
+ hbmtemplateAttributes.put("file_pattern", actionDir + "/{class-name}Home.java"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ hbmtemplateAttributes.put("file_pattern", "{package-name}/{class-name}Home.java"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
hbmtemplateAttributes.put("template_name", "src/EntityHome.java.ftl"); //$NON-NLS-1$ //$NON-NLS-2$
hbmtemplateAttributes.put("outputdir",seamProjectsSet.getActionsFolder().getFullPath().toString()); //$NON-NLS-1$
hbmtemplateAttributes.put("for_each", "entity"); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -10,12 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.core.test;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.tools.seam.core.test.project.facet.Seam2FacetInstallDelegateTest;
import org.jboss.tools.seam.core.test.project.facet.SeamFacetInstallDelegateTest;
import org.jboss.tools.seam.core.test.project.facet.SeamRuntimeListConverterTest;
import org.jboss.tools.seam.core.test.project.facet.SeamRuntimeManagerTest;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
/**
* @author V.Kabanovich
*
@@ -32,6 +33,7 @@
suite.addTestSuite(SeamRuntimeManagerTest.class);
suite.addTestSuite(SeamFacetInstallDelegateTest.class);
+ suite.addTestSuite(Seam2FacetInstallDelegateTest.class);
return suite;
}
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -73,16 +73,24 @@
}
protected void tearDown()
- throws CoreException
+ throws Exception
{
+ Exception last = null;
for (IResource r : this.resourcesToCleanup) {
- r.delete(true, null);
+ try {
+ r.delete(true, null);
+ } catch(Exception e) {
+ e.printStackTrace();
+ last = e;
+ }
}
for (Runnable runnable : this.tearDownOperations) {
runnable.run();
}
+
+ if(last!=null) throw last;
}
protected final void addResourceToCleanup(final IResource resource) {
@@ -106,28 +114,7 @@
return fpj;
}
- protected IFacetedProject createSeamWarProject() throws CoreException {
- final IFacetedProject fproj = ProjectFacetsManager.create("seam12Project", null,
- null);
- installDependentFacets(fproj);
-
- IDataModel config = createSeamDataModel("war");
-
- fproj.installProjectFacet(seamFacetVersion, config, null);
-
- final IProject proj = fproj.getProject();
-
- assertNotNull(proj);
- assertTrue(proj.exists());
-
- assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
-
- this.resourcesToCleanup.add(proj);
-
- return fproj;
- }
-
protected IDataModel createSeamDataModel(String deployType) {
IDataModel config = (IDataModel) new SeamFacetInstallDataModelProvider().create();
config.setStringProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, SEAM_1_2_0);
@@ -148,34 +135,58 @@
fproj.installProjectFacet(javaFacesVersion, null, null);
}
- protected IFacetedProject createSeamEarProject() throws CoreException {
- final IFacetedProject fproj = ProjectFacetsManager.create("seamear12Project", null,
+ protected IFacetedProject createSeamProject(String baseProjectName, IDataModel config) throws CoreException {
+ final IFacetedProject fproj = ProjectFacetsManager.create(baseProjectName, null,
null);
installDependentFacets(fproj);
- IDataModel config = createSeamDataModel("ear");
+ fproj.installProjectFacet(getSeamFacetVersion(), config, null);
- fproj.installProjectFacet(seamFacetVersion, config, null);
+ return fproj;
+ }
+
+ protected IFacetedProject createSeamWarProject(String name) throws CoreException {
+ final IFacetedProject fproj = createSeamProject(name, createSeamDataModel("war"));
final IProject proj = fproj.getProject();
+
assertNotNull(proj);
+ assertTrue(proj.exists());
+
+ /*assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
+ IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
+ this.resourcesToCleanup.add(testProject);*/
+ this.resourcesToCleanup.add(proj);
+
+ return fproj;
+ }
+
+ protected IFacetedProject createSeamEarProject(String name) throws CoreException {
+ final IFacetedProject fproj = createSeamProject(name, createSeamDataModel("ear"));
- IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
+ final IProject proj = fproj.getProject();
+ assertNotNull(proj);
+
+ //IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
IProject ejbProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-ejb");
IProject earProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-ear");
this.resourcesToCleanup.add(proj);
- this.resourcesToCleanup.add(testProject);
+ //this.resourcesToCleanup.add(testProject);
this.resourcesToCleanup.add(ejbProject);
this.resourcesToCleanup.add(earProject);
assertTrue(proj.exists());
- assertTrue(testProject.exists());
+ //assertTrue(testProject.exists());
assertTrue(ejbProject.exists());
assertTrue(earProject.exists());
return fproj;
}
+
+ protected IProjectFacetVersion getSeamFacetVersion() {
+ return seamFacetVersion;
+ }
}
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java 2007-10-21 06:24:01 UTC (rev 4395)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetInstallDelegateTest.java 2007-10-21 06:33:02 UTC (rev 4396)
@@ -13,7 +13,9 @@
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
public class SeamFacetInstallDelegateTest extends AbstractSeamFacetTest {
@@ -21,18 +23,26 @@
super(name);
}
- public void testCreateWarFromScratch() throws CoreException, IOException {
+ public void testCreateWar() throws CoreException, IOException {
- final IFacetedProject fproj = createSeamWarProject();
+ final IFacetedProject fproj = createSeamWarProject("seamwar");
}
- public void testCreateEarFromScratch() throws CoreException, IOException {
+ public void testCreateEar() throws CoreException, IOException {
- final IFacetedProject fproj = createSeamEarProject();
+ final IFacetedProject fproj = createSeamEarProject("seamear");
+ }
+
+ public void testCreateCustomProject() throws CoreException, IOException {
+
+ IDataModel createSeamDataModel = createSeamDataModel("war");
+ createSeamDataModel.setProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME, "x.y.z");
-
+ final IFacetedProject fproj = createSeamProject("customProject",createSeamDataModel);
+
+ assertTrue(fproj.getProject().findMember("src/action/x/y/z").exists());
+
}
-
}
17 years, 2 months
JBoss Tools SVN: r4395 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-10-21 02:24:01 -0400 (Sun, 21 Oct 2007)
New Revision: 4395
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/
Log:
bin ignore
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test
___________________________________________________________________
Name: svn:ignore
- AllTests.txt
+ AllTests.txt
bin
17 years, 2 months
JBoss Tools SVN: r4394 - in trunk/seam/plugins/org.jboss.tools.seam.core: src/org/jboss/tools/seam/internal/core/project/facet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-10-19 19:08:08 -0400 (Fri, 19 Oct 2007)
New Revision: 4394
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
Log:
fixed spelling error
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-10-19 22:40:49 UTC (rev 4393)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-10-19 23:08:08 UTC (rev 4394)
@@ -42,8 +42,7 @@
Seam
</label>
<description>
- Enables the project to work with JBoss Seam
-
+ Enables the project to work with JBoss Seam
</description>
</project-facet>
<project-facet-version
@@ -66,18 +65,51 @@
</and>
</constraint>
</project-facet-version>
+ <!--<project-facet-version
+ facet="jst.seam"
+ version="2.0">
+ <constraint>
+ <and>
+ <requires
+ facet="jst.web"
+ version="[2.4">
+ </requires>
+ <requires
+ facet="jst.jsf"
+ version="[1.2">
+ </requires>
+ <requires
+ facet="jst.java"
+ version="[5.0">
+ </requires>
+ </and>
+ </constraint>
+ </project-facet-version>-->
<action
facet="jst.seam"
id="jst.seam.1.2.install"
type="install"
version="1.2">
<delegate
- class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete">
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegate">
</delegate>
<config-factory
class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider">
</config-factory>
- </action>
+ </action>
+ <!--
+ <action
+ facet="jst.seam"
+ id="jst.seam.2.0.install"
+ type="install"
+ version="2.0">
+ <delegate
+ class="org.jboss.tools.seam.internal.core.project.facet.Seam2FacetInstallDelegate">
+ </delegate>
+ <config-factory
+ class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider">
+ </config-factory>
+ </action> -->
<action
facet="jst.seam"
id="jst.seam.1.2.uninstall"
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java (from rev 4386, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2007-10-19 23:08:08 UTC (rev 4394)
@@ -0,0 +1,673 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+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.eclipse.wst.common.uriresolver.internal.URI;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.ResourcesUtils;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class SeamFacetInstallDelegate extends Object implements IDelegate,ISeamFacetDataModelProperties {
+
+ public static String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
+ public static String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
+ public static String TEST_WAR_PROFILE = "test-war"; //$NON-NLS-1$
+ public static String TEST_EAR_PROFILE = "test"; //$NON-NLS-1$
+
+
+ public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
+ .include("ajax4jsf.*\\.jar") //$NON-NLS-1$
+ .include("richfaces.*\\.jar")
+ .include("antlr.*\\.jar") //$NON-NLS-1$
+ .include("commons-beanutils.*\\.jar") //$NON-NLS-1$
+ .include("commons-collections.*\\.jar") //$NON-NLS-1$
+ .include("commons-digester.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("janino.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-debug\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ioc\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-mail\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-pdf\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-remoting\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ui\\.jar") //$NON-NLS-1$
+ .include("jboss-seam\\.jar") //$NON-NLS-1$
+ .include("jbpm.*\\.jar") //$NON-NLS-1$
+ .include("jsf-facelets\\.jar") //$NON-NLS-1$
+ .include("oscache.*\\.jar") //$NON-NLS-1$
+ .include("stringtemplate.*\\.jar"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
+ .include("testng-.*-jdk15\\.jar") //$NON-NLS-1$
+ .include("myfaces-api-.*\\.jar") //$NON-NLS-1$
+ .include("myfaces-impl-.*\\.jar") //$NON-NLS-1$
+ .include("servlet-api\\.jar") //$NON-NLS-1$
+ .include("hibernate-all\\.jar") //$NON-NLS-1$
+ .include("jboss-ejb3-all\\.jar") //$NON-NLS-1$
+ .include("thirdparty-all\\.jar") //$NON-NLS-1$
+ .include("el-api\\.jar") //$NON-NLS-1$
+ .include("el-ri\\.jar") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
+ .include("ajax4jsf.*\\.jar") //$NON-NLS-1$
+ .include("richfaces.*\\.jar") //$NON-NLS-1$
+ .include("commons-beanutils.*\\.jar") //$NON-NLS-1$
+ .include("commons-digester.*\\.jar") //$NON-NLS-1$
+ .include("commons-collections.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-debug\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ioc\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-mail\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-pdf\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-remoting\\.jar") //$NON-NLS-1$
+ .include("jboss-seam-ui\\.jar") //$NON-NLS-1$
+ .include("jsf-facelets\\.jar") //$NON-NLS-1$
+ .include("oscache.*\\.jar"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
+ .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
+ .include("drools-compiler.*\\.jar") //$NON-NLS-1$
+ .include("drools-core.*\\.jar") //$NON-NLS-1$
+ .include("janino.*\\.jar") //$NON-NLS-1$
+ .include("jboss-seam.jar") //$NON-NLS-1$
+ .include("jbpm.*\\.jar") //$NON-NLS-1$
+ .include("security\\.drl") //$NON-NLS-1$
+ .include("stringtemplate.*\\.jar"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
+ .include("META-INF/application\\.xml") //$NON-NLS-1$
+ .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
+ .include("home\\.xhtml") //$NON-NLS-1$
+ .include("error\\.xhtml") //$NON-NLS-1$
+ .include("login\\.xhtml") //$NON-NLS-1$
+ .include("login\\.page.xml") //$NON-NLS-1$
+ .include("index\\.html") //$NON-NLS-1$
+ .include("layout") //$NON-NLS-1$
+ .include("layout/.*") //$NON-NLS-1$
+ .include("stylesheet") //$NON-NLS-1$
+ .include("stylesheet/.*") //$NON-NLS-1$
+ .include("img/.*") //$NON-NLS-1$
+ .include("img") //$NON-NLS-1$
+ .exclude(".*/.*\\.ftl") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet CVS_SVN = new AntCopyUtils.FileSet()
+ .include(".*") //$NON-NLS-1$
+ .exclude(".*/CVS") //$NON-NLS-1$
+ .exclude("CVS") //$NON-NLS-1$
+ .exclude(".*\\.svn") //$NON-NLS-1$
+ .exclude(".*/\\.svn"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
+ .include("WEB-INF") //$NON-NLS-1$
+ .include("WEB-INF/web\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/pages\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/jboss-web\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/faces-config\\.xml") //$NON-NLS-1$
+ .include("WEB-INF/componets\\.xml"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
+ .include("import\\.sql") //$NON-NLS-1$
+ .include("security\\.drl") //$NON-NLS-1$
+ .include("seam\\.properties") //$NON-NLS-1$
+ .include("messages_en\\.properties"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
+ .include("import\\.sql") //$NON-NLS-1$
+ .include("seam\\.properties")
+ .exclude(".*/WEB-INF"); //$NON-NLS-1$
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_META_INF_SET = new AntCopyUtils.FileSet()
+ .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
+
+ public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib"; //$NON-NLS-1$
+
+ public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
+
+ public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib"; //$NON-NLS-1$
+
+ public void execute(final IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ final IDataModel model = (IDataModel)config;
+
+ // get WebContents folder path from DWP model
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ final IVirtualFolder srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")); //$NON-NLS-1$
+ IContainer webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, project.getName()+"-test"); //$NON-NLS-1$
+
+ Boolean dbExists = (Boolean)model.getProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
+ Boolean dbRecreate = (Boolean)model.getProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
+ if(!dbExists && !dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"update"); //$NON-NLS-1$
+ } else if(dbExists && !dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"validate"); //$NON-NLS-1$
+ } else if(dbRecreate) {
+ model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"create-drop"); //$NON-NLS-1$
+ }
+
+ final File webContentFolder = webRootFolder.getLocation().toFile();
+ final File webInfFolder = new File(webContentFolder,"WEB-INF"); //$NON-NLS-1$
+ final File webInfClasses = new File(webInfFolder,"classes"); //$NON-NLS-1$
+ final File webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
+ webInfClassesMetaInf.mkdirs();
+ final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
+ final File srcFolder = isWarConfiguration(model)?new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(),"model"):srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
+ final File webMetaInf = new File(webContentFolder, "META-INF"); //$NON-NLS-1$
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
+
+ final String seamHomePath = selectedRuntime.getHomeDir();
+
+ final File seamHomeFolder = new File(seamHomePath);
+ final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
+ final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources"); //$NON-NLS-1$
+ final File seamGenResMetainfFolder = new File(seamGenResFolder,"META-INF"); //$NON-NLS-1$
+
+ final File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
+ final File seamGenHomeFolder = new File(seamHomePath,"seam-gen"); //$NON-NLS-1$
+ final File seamGenViewSource = new File(seamGenHomeFolder,"view"); //$NON-NLS-1$
+ final File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
+ final File componentsFile = new File(seamGenResFolder,"WEB-INF/components"+(isWarConfiguration(model)?"-war":"")+".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
+ final File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
+ final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
+ final File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + (isWarConfiguration(model)?DEV_WAR_PROFILE:DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ final File applicationFile = new File(seamGenResFolder,"META-INF/application.xml"); //$NON-NLS-1$
+
+ final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+ final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+
+ // ****************************************************************
+ // Copy view folder from seam-gen installation to WebContent folder
+ // ****************************************************************
+ final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
+ final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
+ viewFilterSetCollection.addFilterSet(jdbcFilterSet);
+ viewFilterSetCollection.addFilterSet(projectFilterSet);
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenViewSource,
+ webContentFolder,
+ new AntCopyUtils.FileSetFileFilter(viewFileSet),
+ viewFilterSetCollection,
+ true);
+
+ // *******************************************************************
+ // Copy manifest and configuration resources the same way as view
+ // *******************************************************************
+ AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
+
+ AntCopyUtils.copyFileToFile(
+ componentsFile,
+ new File(webInfFolder,"components.xml"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,webContentFolder,new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
+
+
+ final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
+ hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
+ hibernateDialectFilterSet.addFilterSet(projectFilterSet);
+ hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
+
+
+ createTestProject(model,project,selectedRuntime);
+
+ // ********************************************************************************************
+ // Handle WAR/EAR configurations
+ // ********************************************************************************************
+ if(isWarConfiguration(model)) {
+
+ AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,srcFolder,new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
+
+ createComponentsProperties(srcFolder, isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ // In case of WAR configuration
+ AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
+
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), srcFolder, true); //$NON-NLS-1$
+ final IContainer source = srcRootFolder.getUnderlyingFolder();
+
+ IPath actionSrcPath = new Path(source.getFullPath().lastSegment()+"/action"); //$NON-NLS-1$
+ IPath modelSrcPath = new Path(source.getFullPath().lastSegment()+"/model"); //$NON-NLS-1$
+
+ srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
+ WtpUtils.createSourceFolder(project, actionSrcPath, new Path(source.getFullPath().lastSegment()), new Path(webRootFolder.getLocation().lastSegment()+"/WEB-INF/dev")); //$NON-NLS-1$
+ WtpUtils.createSourceFolder(project, modelSrcPath, new Path(source.getFullPath().lastSegment()), null);
+
+ srcRootFolder.createLink(actionSrcPath, 0, null);
+ srcRootFolder.createLink(modelSrcPath, 0, null);
+
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
+ new File(project.getLocation().toFile(),source.getFullPath().lastSegment()+"/action/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), true);
+
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(srcFolder,project.getName()+"-ds.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(project.getLocation().toFile(),project.getName()+".launch"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ project.getLocation().toFile(),
+ hibernateDialectFilterSet, true);
+
+ WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
+
+ Job create = new DataSourceXmlDeployer(project);
+ create.setUser(true);
+ create.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ create.schedule();
+
+ } else {
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, project.getName()+"-ejb"); //$NON-NLS-1$
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, project.getName()+"-ear"); //$NON-NLS-1$
+
+ // In case of EAR configuration
+ AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"messages_en.properties"),srcFolder, true); //$NON-NLS-1$
+
+ File ear = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear"); //$NON-NLS-1$
+ File ejb = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb"); //$NON-NLS-1$
+ ear.mkdir();
+ ejb.mkdir();
+
+ try {
+ FilterSet filterSet = new FilterSet();
+ filterSet.addFilter("projectName", project.getName()); //$NON-NLS-1$
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project)); //$NON-NLS-1$
+ if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null) {
+ File driver = new File(((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ filterSet.addFilter("driverJar"," " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ filterSet.addFilter("driverJar",""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ AntCopyUtils.FileSet excludeCvsSvn = new AntCopyUtils.FileSet(CVS_SVN).dir(seamGenResFolder);
+
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb"), //$NON-NLS-1$
+ ejb, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ // *******************************************************************************************
+ // Copy sources to ejb project in case of EAR configuration
+ // *******************************************************************************************
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
+ new File(ejb,"ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), true);
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(ejb,"ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ createComponentsProperties(new File(ejb,"ejbModule"), isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,new File(ejb,"ejbModule"),new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, true); //$NON-NLS-1$
+
+
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), new File(ejb,"ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(ejb,"ejbModule/"+project.getName()+"-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder,"META-INF/ejb-jar.xml"), //$NON-NLS-1$
+ new File(ejb,"ejbModule/META-INF/"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(ejb,".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);
+
+ FilterSet ejbFilterSet = new FilterSet();
+ ejbFilterSet.addFilter("projectName",ejb.getName()); //$NON-NLS-1$
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(ejb,ejb.getName()+".launch"), //$NON-NLS-1$
+ new FilterSetCollection(ejbFilterSet), true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ ejb,
+ hibernateDialectFilterSet, true);
+
+ File earContentsFolder = new File(ear,"EarContent"); //$NON-NLS-1$
+
+ FilterSet earFilterSet = new FilterSet();
+ earFilterSet.addFilter("projectName",ear.getName()+".ear"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder,"META-INF/jboss-app.xml"), //$NON-NLS-1$
+ new File(earContentsFolder,"META-INF"), //$NON-NLS-1$
+ new FilterSetCollection(earFilterSet),true);
+
+ // Copy configuration files from template
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ear"), //$NON-NLS-1$
+ ear, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ // Fill ear contents
+ AntCopyUtils.copyFiles(seamHomeFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
+
+ try {
+
+ File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
+ /* (non-Javadoc)
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ public boolean accept(File dir, String name) {
+ if(name.lastIndexOf(".jar")>0) return true; //$NON-NLS-1$
+ return false;
+ }
+ });
+ String earJarsStr = ""; //$NON-NLS-1$
+ for (File file : earJars) {
+ earJarsStr +=" " + file.getName() +" \n"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ FilterSetCollection manifestFilterCol = new FilterSetCollection(projectFilterSet);
+ FilterSet manifestFilter = new FilterSet();
+ manifestFilter.addFilter("earLibs",earJarsStr); //$NON-NLS-1$
+ manifestFilterCol.addFilterSet(manifestFilter);
+ AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterCol, true); //$NON-NLS-1$
+ File ejbMetaInf = new File(ejb,"ejbModule/META-INF"); //$NON-NLS-1$
+ AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterCol, true); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ ClasspathHelper.addClasspathEntries(project, fv);
+
+ createSeamProjectPreferenes(project, model);
+
+
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ String wsPath = project.getLocation().removeLastSegments(1)
+ .toFile().getAbsoluteFile().getPath();
+
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ if(!isWarConfiguration(model)) {
+
+ IProject ejbProjectToBeImported = wsRoot.getProject(project.getName()+"-ejb");
+ ResourcesUtils.importExistingProject(ejbProjectToBeImported, wsPath+"/"+project.getName()+"-ejb", project.getName()+"-ejb");
+
+ IProject earProjectToBeImported = wsRoot.getProject(project.getName()+"-ear");
+ ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath+"/"+project.getName()+"-ear", project.getName()+"-ear");
+ }
+
+ IProject testProjectToBeImported = wsRoot.getProject(project.getName()+"-test");
+ ResourcesUtils.importExistingProject(testProjectToBeImported, wsPath+"/"+project.getName()+"-test", project.getName()+"-test");
+
+ }
+
+
+
+ public static boolean isWarConfiguration(IDataModel model) {
+ return "war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)); //$NON-NLS-1$
+ }
+
+
+ /**
+ * @param project
+ * @param model
+ */
+ private void createSeamProjectPreferenes(final IProject project,
+ final IDataModel model) {
+ IScopeContext projectScope = new ProjectScope(project);
+ IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
+
+ prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
+
+ prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
+
+ prefs.put(SEAM_CONNECTION_PROFILE,model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+
+ prefs.put(SESION_BEAN_PACKAGE_NAME, model.getProperty(SESION_BEAN_PACKAGE_NAME).toString());
+
+ prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
+
+ prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
+
+ prefs.put(SEAM_TEST_PROJECT,
+ model.getProperty(SEAM_TEST_PROJECT)==null?
+ "":model.getProperty(SEAM_TEST_PROJECT).toString()); //$NON-NLS-1$
+
+ if(DEPLOY_AS_EAR.equals(model.getProperty(JBOSS_AS_DEPLOY_AS))) {
+ prefs.put(SEAM_EJB_PROJECT,
+ model.getProperty(SEAM_EJB_PROJECT)==null?
+ "":model.getProperty(SEAM_EJB_PROJECT).toString()); //$NON-NLS-1$
+
+ prefs.put(SEAM_EAR_PROJECT,
+ model.getProperty(SEAM_EAR_PROJECT)==null?
+ "":model.getProperty(SEAM_EAR_PROJECT).toString()); //$NON-NLS-1$
+ }
+
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ private void createTestProject(IDataModel model, IProject seamWebProject, SeamRuntime seamRuntime) {
+ String projectName = model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME).toString();
+ File testProjectDir = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(),projectName+"-test"); //$NON-NLS-1$
+ testProjectDir.mkdir();
+
+ IVirtualComponent component = ComponentCore.createComponent(seamWebProject);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+
+ File testLibDir = new File(testProjectDir,"lib"); //$NON-NLS-1$
+ File embededEjbDir = new File(testProjectDir,"embedded-ejb"); //$NON-NLS-1$
+ File testSrcDir = new File(testProjectDir,"test-src"); //$NON-NLS-1$
+ String seamGenResFolder = seamRuntime.getResourceTemplatesDir();
+ File persistenceFile = new File(seamGenResFolder ,"META-INF/persistence-" + (isWarConfiguration(model)?TEST_WAR_PROFILE:TEST_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+ File jbossBeansFile = new File(seamGenResFolder ,"META-INF/jboss-beans.xml"); //$NON-NLS-1$
+ FilterSet filterSet = new FilterSet();
+ filterSet.addFilter("projectName", projectName); //$NON-NLS-1$
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
+ filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getLocation().lastSegment()); //$NON-NLS-1$
+
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
+ final String seamHomePath = selectedRuntime.getHomeDir();
+
+ AntCopyUtils.FileSet includeLibs
+ = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
+ .dir(new File(seamRuntime.getHomeDir(),"lib")); //$NON-NLS-1$
+ File[] libs = includeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(includeLibs));
+ StringBuffer testLibraries = new StringBuffer();
+
+ for (File file : libs) {
+ testLibraries.append("\t<classpathentry kind=\"lib\" path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ StringBuffer requiredProjects = new StringBuffer();
+ requiredProjects.append(
+ "\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ if(!isWarConfiguration(model)) {
+ requiredProjects.append(
+ "\n\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "-ejb\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ filterSet.addFilter("testLibraries",testLibraries.toString()); //$NON-NLS-1$
+ filterSet.addFilter("requiredProjects",requiredProjects.toString()); //$NON-NLS-1$
+ File testTemplateDir = null;
+ try {
+ testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"test"); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+ AntCopyUtils.FileSet excludeCvsSvn
+ = new AntCopyUtils.FileSet(CVS_SVN).dir(testTemplateDir);
+
+ AntCopyUtils.copyFilesAndFolders(
+ testTemplateDir,
+ testProjectDir,
+ new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
+ new FilterSetCollection(filterSet), true);
+
+ excludeCvsSvn.dir(new File(seamRuntime.getHomeDir(),"embedded-ejb/conf")); //$NON-NLS-1$
+ AntCopyUtils.copyFiles(
+ new File(seamRuntime.getHomeDir(),"embedded-ejb/conf"), //$NON-NLS-1$
+ embededEjbDir,
+ new AntCopyUtils.FileSetFileFilter(excludeCvsSvn));
+
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(testProjectDir,"test-src/META-INF/persistence.xml"), //$NON-NLS-1$
+ new FilterSetCollection(filterSet), true);
+
+ AntCopyUtils.copyFileToFolder(
+ jbossBeansFile,
+ new File(testProjectDir,"test-src/META-INF"), //$NON-NLS-1$
+ new FilterSetCollection(filterSet), true);
+
+ AntCopyUtils.copyFiles(
+ new File(seamRuntime.getHomeDir(),"lib"), //$NON-NLS-1$
+ testLibDir,
+ new AntCopyUtils.FileSetFileFilter(includeLibs));
+
+ createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
+ }
+
+ /**
+ * @param seamGenResFolder
+ */
+ private void createComponentsProperties(final File seamGenResFolder, String projectName, Boolean embedded) {
+ Properties components = new Properties();
+ String prefix = "".equals(projectName)?"":projectName+"/"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ components.put("embeddedEjb", embedded.toString()); //$NON-NLS-1$
+ components.put("jndiPattern", prefix+"#{ejbName}/local"); //$NON-NLS-1$ //$NON-NLS-2$
+ File componentsProps = new File(seamGenResFolder,"components.properties"); //$NON-NLS-1$
+ try {
+ componentsProps.createNewFile();
+ components.store(new FileOutputStream(componentsProps), ""); //$NON-NLS-1$
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.common.project.facet.core.IActionConfigFactory#create()
+ */
+ public Object create() throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-10-19 22:40:49 UTC (rev 4393)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-10-19 23:08:08 UTC (rev 4394)
@@ -1,673 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.project.facet;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-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.eclipse.wst.common.uriresolver.internal.URI;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.util.ResourcesUtils;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.core.project.facet.SeamRuntime;
-import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
-import org.osgi.service.prefs.BackingStoreException;
-
-public class SeamFacetInstallDelegete extends Object implements IDelegate,ISeamFacetDataModelProperties {
-
- public static String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
- public static String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
- public static String TEST_WAR_PROFILE = "test-war"; //$NON-NLS-1$
- public static String TEST_EAR_PROFILE = "test"; //$NON-NLS-1$
-
-
- public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
- .include("ajax4jsf.*\\.jar") //$NON-NLS-1$
- .include("richfaces.*\\.jar")
- .include("antlr.*\\.jar") //$NON-NLS-1$
- .include("commons-beanutils.*\\.jar") //$NON-NLS-1$
- .include("commons-collections.*\\.jar") //$NON-NLS-1$
- .include("commons-digester.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
- .include("drools-compiler.*\\.jar") //$NON-NLS-1$
- .include("drools-core.*\\.jar") //$NON-NLS-1$
- .include("janino.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam-debug\\.jar") //$NON-NLS-1$
- .include("jboss-seam-ioc\\.jar") //$NON-NLS-1$
- .include("jboss-seam-mail\\.jar") //$NON-NLS-1$
- .include("jboss-seam-pdf\\.jar") //$NON-NLS-1$
- .include("jboss-seam-remoting\\.jar") //$NON-NLS-1$
- .include("jboss-seam-ui\\.jar") //$NON-NLS-1$
- .include("jboss-seam\\.jar") //$NON-NLS-1$
- .include("jbpm.*\\.jar") //$NON-NLS-1$
- .include("jsf-facelets\\.jar") //$NON-NLS-1$
- .include("oscache.*\\.jar") //$NON-NLS-1$
- .include("stringtemplate.*\\.jar"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOSS_TEST_LIB_FILESET = new AntCopyUtils.FileSet()
- .include("testng-.*-jdk15\\.jar") //$NON-NLS-1$
- .include("myfaces-api-.*\\.jar") //$NON-NLS-1$
- .include("myfaces-impl-.*\\.jar") //$NON-NLS-1$
- .include("servlet-api\\.jar") //$NON-NLS-1$
- .include("hibernate-all\\.jar") //$NON-NLS-1$
- .include("jboss-ejb3-all\\.jar") //$NON-NLS-1$
- .include("thirdparty-all\\.jar") //$NON-NLS-1$
- .include("el-api\\.jar") //$NON-NLS-1$
- .include("el-ri\\.jar") //$NON-NLS-1$
- .exclude(".*/CVS") //$NON-NLS-1$
- .exclude(".*/\\.svn"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
- .include("ajax4jsf.*\\.jar") //$NON-NLS-1$
- .include("richfaces.*\\.jar") //$NON-NLS-1$
- .include("commons-beanutils.*\\.jar") //$NON-NLS-1$
- .include("commons-digester.*\\.jar") //$NON-NLS-1$
- .include("commons-collections.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam-debug\\.jar") //$NON-NLS-1$
- .include("jboss-seam-ioc\\.jar") //$NON-NLS-1$
- .include("jboss-seam-mail\\.jar") //$NON-NLS-1$
- .include("jboss-seam-pdf\\.jar") //$NON-NLS-1$
- .include("jboss-seam-remoting\\.jar") //$NON-NLS-1$
- .include("jboss-seam-ui\\.jar") //$NON-NLS-1$
- .include("jsf-facelets\\.jar") //$NON-NLS-1$
- .include("oscache.*\\.jar"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
- .include("antlr.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-core.*\\.jar") //$NON-NLS-1$
- .include("commons-jci-janino.*\\.jar") //$NON-NLS-1$
- .include("drools-compiler.*\\.jar") //$NON-NLS-1$
- .include("drools-core.*\\.jar") //$NON-NLS-1$
- .include("janino.*\\.jar") //$NON-NLS-1$
- .include("jboss-seam.jar") //$NON-NLS-1$
- .include("jbpm.*\\.jar") //$NON-NLS-1$
- .include("security\\.drl") //$NON-NLS-1$
- .include("stringtemplate.*\\.jar"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
- .include("META-INF/application\\.xml") //$NON-NLS-1$
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
- .include("home\\.xhtml") //$NON-NLS-1$
- .include("error\\.xhtml") //$NON-NLS-1$
- .include("login\\.xhtml") //$NON-NLS-1$
- .include("login\\.page.xml") //$NON-NLS-1$
- .include("index\\.html") //$NON-NLS-1$
- .include("layout") //$NON-NLS-1$
- .include("layout/.*") //$NON-NLS-1$
- .include("stylesheet") //$NON-NLS-1$
- .include("stylesheet/.*") //$NON-NLS-1$
- .include("img/.*") //$NON-NLS-1$
- .include("img") //$NON-NLS-1$
- .exclude(".*/.*\\.ftl") //$NON-NLS-1$
- .exclude(".*/CVS") //$NON-NLS-1$
- .exclude(".*/\\.svn"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet CVS_SVN = new AntCopyUtils.FileSet()
- .include(".*") //$NON-NLS-1$
- .exclude(".*/CVS") //$NON-NLS-1$
- .exclude("CVS") //$NON-NLS-1$
- .exclude(".*\\.svn") //$NON-NLS-1$
- .exclude(".*/\\.svn"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
- .include("WEB-INF") //$NON-NLS-1$
- .include("WEB-INF/web\\.xml") //$NON-NLS-1$
- .include("WEB-INF/pages\\.xml") //$NON-NLS-1$
- .include("WEB-INF/jboss-web\\.xml") //$NON-NLS-1$
- .include("WEB-INF/faces-config\\.xml") //$NON-NLS-1$
- .include("WEB-INF/componets\\.xml"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
- .include("import\\.sql") //$NON-NLS-1$
- .include("security\\.drl") //$NON-NLS-1$
- .include("seam\\.properties") //$NON-NLS-1$
- .include("messages_en\\.properties"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOOS_EJB_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
- .include("import\\.sql") //$NON-NLS-1$
- .include("seam\\.properties")
- .exclude(".*/WEB-INF"); //$NON-NLS-1$
-
- public static AntCopyUtils.FileSet JBOSS_EAR_META_INF_SET = new AntCopyUtils.FileSet()
- .include("META-INF/jboss-app\\.xml"); //$NON-NLS-1$
-
- public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib"; //$NON-NLS-1$
-
- public static String SEAM_LIB_RELATED_PATH = "lib"; //$NON-NLS-1$
-
- public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib"; //$NON-NLS-1$
-
- public void execute(final IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
- final IDataModel model = (IDataModel)config;
-
- // get WebContents folder path from DWP model
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- final IVirtualFolder srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")); //$NON-NLS-1$
- IContainer webRootFolder = webRootVirtFolder.getUnderlyingFolder();
-
- model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
- model.setProperty(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, project.getName()+"-test"); //$NON-NLS-1$
-
- Boolean dbExists = (Boolean)model.getProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS);
- Boolean dbRecreate = (Boolean)model.getProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY);
- if(!dbExists && !dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"update"); //$NON-NLS-1$
- } else if(dbExists && !dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"validate"); //$NON-NLS-1$
- } else if(dbRecreate) {
- model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO,"create-drop"); //$NON-NLS-1$
- }
-
- final File webContentFolder = webRootFolder.getLocation().toFile();
- final File webInfFolder = new File(webContentFolder,"WEB-INF"); //$NON-NLS-1$
- final File webInfClasses = new File(webInfFolder,"classes"); //$NON-NLS-1$
- final File webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
- webInfClassesMetaInf.mkdirs();
- final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
- final File srcFolder = isWarConfiguration(model)?new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(),"model"):srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
- final File webMetaInf = new File(webContentFolder, "META-INF"); //$NON-NLS-1$
- final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
-
- final String seamHomePath = selectedRuntime.getHomeDir();
-
- final File seamHomeFolder = new File(seamHomePath);
- final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
- final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources"); //$NON-NLS-1$
- final File seamGenResMetainfFolder = new File(seamGenResFolder,"META-INF"); //$NON-NLS-1$
-
- final File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
- final File seamGenHomeFolder = new File(seamHomePath,"seam-gen"); //$NON-NLS-1$
- final File seamGenViewSource = new File(seamGenHomeFolder,"view"); //$NON-NLS-1$
- final File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
- final File componentsFile = new File(seamGenResFolder,"WEB-INF/components"+(isWarConfiguration(model)?"-war":"")+".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
- final File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
- final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
- final File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + (isWarConfiguration(model)?DEV_WAR_PROFILE:DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
-
- final File applicationFile = new File(seamGenResFolder,"META-INF/application.xml"); //$NON-NLS-1$
-
- final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
- final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
- final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
-
- // ****************************************************************
- // Copy view folder from seam-gen installation to WebContent folder
- // ****************************************************************
- final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
- final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
- viewFilterSetCollection.addFilterSet(jdbcFilterSet);
- viewFilterSetCollection.addFilterSet(projectFilterSet);
-
- AntCopyUtils.copyFilesAndFolders(
- seamGenViewSource,
- webContentFolder,
- new AntCopyUtils.FileSetFileFilter(viewFileSet),
- viewFilterSetCollection,
- true);
-
- // *******************************************************************
- // Copy manifest and configuration resources the same way as view
- // *******************************************************************
- AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
-
- AntCopyUtils.copyFileToFile(
- componentsFile,
- new File(webInfFolder,"components.xml"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);
-
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,webContentFolder,new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
-
-
- final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
- hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
- hibernateDialectFilterSet.addFilterSet(projectFilterSet);
- hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
-
-
- createTestProject(model,project,selectedRuntime);
-
- // ********************************************************************************************
- // Handle WAR/EAR configurations
- // ********************************************************************************************
- if(isWarConfiguration(model)) {
-
- AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,srcFolder,new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
-
- createComponentsProperties(srcFolder, isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);
-
- // In case of WAR configuration
- AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
-
- // ********************************************************************************************
- // Copy seam project indicator
- // ********************************************************************************************
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), srcFolder, true); //$NON-NLS-1$
- final IContainer source = srcRootFolder.getUnderlyingFolder();
-
- IPath actionSrcPath = new Path(source.getFullPath().lastSegment()+"/action"); //$NON-NLS-1$
- IPath modelSrcPath = new Path(source.getFullPath().lastSegment()+"/model"); //$NON-NLS-1$
-
- srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
- WtpUtils.createSourceFolder(project, actionSrcPath, new Path(source.getFullPath().lastSegment()), new Path(webRootFolder.getLocation().lastSegment()+"/WEB-INF/dev")); //$NON-NLS-1$
- WtpUtils.createSourceFolder(project, modelSrcPath, new Path(source.getFullPath().lastSegment()), null);
-
- srcRootFolder.createLink(actionSrcPath, 0, null);
- srcRootFolder.createLink(modelSrcPath, 0, null);
-
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new File(project.getLocation().toFile(),source.getFullPath().lastSegment()+"/action/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), true);
-
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(srcFolder,project.getName()+"-ds.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(project.getLocation().toFile(),project.getName()+".launch"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- project.getLocation().toFile(),
- hibernateDialectFilterSet, true);
-
- WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
-
- Job create = new DataSourceXmlDeployer(project);
- create.setUser(true);
- create.setRule(ResourcesPlugin.getWorkspace().getRoot());
- create.schedule();
-
- } else {
- model.setProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, project.getName()+"-ejb"); //$NON-NLS-1$
- model.setProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, project.getName()+"-ear"); //$NON-NLS-1$
-
- // In case of EAR configuration
- AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"messages_en.properties"),srcFolder, true); //$NON-NLS-1$
-
- File ear = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear"); //$NON-NLS-1$
- File ejb = new File(project.getLocation().removeLastSegments(1).toFile(),model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb"); //$NON-NLS-1$
- ear.mkdir();
- ejb.mkdir();
-
- try {
- FilterSet filterSet = new FilterSet();
- filterSet.addFilter("projectName", project.getName()); //$NON-NLS-1$
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project)); //$NON-NLS-1$
- if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null) {
- File driver = new File(((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
- filterSet.addFilter("driverJar"," " + driver.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else {
- filterSet.addFilter("driverJar",""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- AntCopyUtils.FileSet excludeCvsSvn = new AntCopyUtils.FileSet(CVS_SVN).dir(seamGenResFolder);
-
- AntCopyUtils.copyFilesAndFolders(
- new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb"), //$NON-NLS-1$
- ejb, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- // *******************************************************************************************
- // Copy sources to ejb project in case of EAR configuration
- // *******************************************************************************************
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new File(ejb,"ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), true);
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(ejb,"ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- createComponentsProperties(new File(ejb,"ejbModule"), isWarConfiguration(model)?"":project.getName()+"-ear", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,new File(ejb,"ejbModule"),new AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, true); //$NON-NLS-1$
-
-
- // ********************************************************************************************
- // Copy seam project indicator
- // ********************************************************************************************
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), new File(ejb,"ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
-
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(ejb,"ejbModule/"+project.getName()+"-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder,"META-INF/ejb-jar.xml"), //$NON-NLS-1$
- new File(ejb,"ejbModule/META-INF/"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(ejb,".settings"), //$NON-NLS-1$
- new FilterSetCollection(projectFilterSet), true);
-
- FilterSet ejbFilterSet = new FilterSet();
- ejbFilterSet.addFilter("projectName",ejb.getName()); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(ejb,ejb.getName()+".launch"), //$NON-NLS-1$
- new FilterSetCollection(ejbFilterSet), true);
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- ejb,
- hibernateDialectFilterSet, true);
-
- File earContentsFolder = new File(ear,"EarContent"); //$NON-NLS-1$
-
- FilterSet earFilterSet = new FilterSet();
- earFilterSet.addFilter("projectName",ear.getName()+".ear"); //$NON-NLS-1$ //$NON-NLS-2$
-
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder,"META-INF/jboss-app.xml"), //$NON-NLS-1$
- new File(earContentsFolder,"META-INF"), //$NON-NLS-1$
- new FilterSetCollection(earFilterSet),true);
-
- // Copy configuration files from template
- AntCopyUtils.copyFilesAndFolders(
- new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ear"), //$NON-NLS-1$
- ear, new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- // Fill ear contents
- AntCopyUtils.copyFiles(seamHomeFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(droolsLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)));
- AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
- AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
-
- try {
-
- File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
- /* (non-Javadoc)
- * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
- */
- public boolean accept(File dir, String name) {
- if(name.lastIndexOf(".jar")>0) return true; //$NON-NLS-1$
- return false;
- }
- });
- String earJarsStr = ""; //$NON-NLS-1$
- for (File file : earJars) {
- earJarsStr +=" " + file.getName() +" \n"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- FilterSetCollection manifestFilterCol = new FilterSetCollection(projectFilterSet);
- FilterSet manifestFilter = new FilterSet();
- manifestFilter.addFilter("earLibs",earJarsStr); //$NON-NLS-1$
- manifestFilterCol.addFilterSet(manifestFilter);
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterCol, true); //$NON-NLS-1$
- File ejbMetaInf = new File(ejb,"ejbModule/META-INF"); //$NON-NLS-1$
- AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterCol, true); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
-
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
-
- ClasspathHelper.addClasspathEntries(project, fv);
-
- createSeamProjectPreferenes(project, model);
-
-
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- String wsPath = project.getLocation().removeLastSegments(1)
- .toFile().getAbsoluteFile().getPath();
-
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
-
- if(!isWarConfiguration(model)) {
-
- IProject ejbProjectToBeImported = wsRoot.getProject(project.getName()+"-ejb");
- ResourcesUtils.importExistingProject(ejbProjectToBeImported, wsPath+"/"+project.getName()+"-ejb", project.getName()+"-ejb");
-
- IProject earProjectToBeImported = wsRoot.getProject(project.getName()+"-ear");
- ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath+"/"+project.getName()+"-ear", project.getName()+"-ear");
- }
-
- IProject testProjectToBeImported = wsRoot.getProject(project.getName()+"-test");
- ResourcesUtils.importExistingProject(testProjectToBeImported, wsPath+"/"+project.getName()+"-test", project.getName()+"-test");
-
- }
-
-
-
- public static boolean isWarConfiguration(IDataModel model) {
- return "war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)); //$NON-NLS-1$
- }
-
-
- /**
- * @param project
- * @param model
- */
- private void createSeamProjectPreferenes(final IProject project,
- final IDataModel model) {
- IScopeContext projectScope = new ProjectScope(project);
- IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
-
- prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
-
- prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
-
- prefs.put(SEAM_CONNECTION_PROFILE,model.getProperty(SEAM_CONNECTION_PROFILE).toString());
-
- prefs.put(SESION_BEAN_PACKAGE_NAME, model.getProperty(SESION_BEAN_PACKAGE_NAME).toString());
-
- prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
-
- prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
-
- prefs.put(SEAM_TEST_PROJECT,
- model.getProperty(SEAM_TEST_PROJECT)==null?
- "":model.getProperty(SEAM_TEST_PROJECT).toString()); //$NON-NLS-1$
-
- if(DEPLOY_AS_EAR.equals(model.getProperty(JBOSS_AS_DEPLOY_AS))) {
- prefs.put(SEAM_EJB_PROJECT,
- model.getProperty(SEAM_EJB_PROJECT)==null?
- "":model.getProperty(SEAM_EJB_PROJECT).toString()); //$NON-NLS-1$
-
- prefs.put(SEAM_EAR_PROJECT,
- model.getProperty(SEAM_EAR_PROJECT)==null?
- "":model.getProperty(SEAM_EAR_PROJECT).toString()); //$NON-NLS-1$
- }
-
- try {
- prefs.flush();
- } catch (BackingStoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
-
- private void createTestProject(IDataModel model, IProject seamWebProject, SeamRuntime seamRuntime) {
- String projectName = model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME).toString();
- File testProjectDir = new File(seamWebProject.getLocation().removeLastSegments(1).toFile(),projectName+"-test"); //$NON-NLS-1$
- testProjectDir.mkdir();
-
- IVirtualComponent component = ComponentCore.createComponent(seamWebProject);
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
-
- File testLibDir = new File(testProjectDir,"lib"); //$NON-NLS-1$
- File embededEjbDir = new File(testProjectDir,"embedded-ejb"); //$NON-NLS-1$
- File testSrcDir = new File(testProjectDir,"test-src"); //$NON-NLS-1$
- String seamGenResFolder = seamRuntime.getResourceTemplatesDir();
- File persistenceFile = new File(seamGenResFolder ,"META-INF/persistence-" + (isWarConfiguration(model)?TEST_WAR_PROFILE:TEST_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
- File jbossBeansFile = new File(seamGenResFolder ,"META-INF/jboss-beans.xml"); //$NON-NLS-1$
- FilterSet filterSet = new FilterSet();
- filterSet.addFilter("projectName", projectName); //$NON-NLS-1$
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
- filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getLocation().lastSegment()); //$NON-NLS-1$
-
- final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
- final String seamHomePath = selectedRuntime.getHomeDir();
-
- AntCopyUtils.FileSet includeLibs
- = new AntCopyUtils.FileSet(JBOSS_TEST_LIB_FILESET)
- .dir(new File(seamRuntime.getHomeDir(),"lib")); //$NON-NLS-1$
- File[] libs = includeLibs.getDir().listFiles(new AntCopyUtils.FileSetFileFilter(includeLibs));
- StringBuffer testLibraries = new StringBuffer();
-
- for (File file : libs) {
- testLibraries.append("\t<classpathentry kind=\"lib\" path=\"lib/" + file.getName() + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- StringBuffer requiredProjects = new StringBuffer();
- requiredProjects.append(
- "\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
- if(!isWarConfiguration(model)) {
- requiredProjects.append(
- "\n\t<classpathentry combineaccessrules=\"false\" kind=\"src\" path=\"/" + seamWebProject.getName() + "-ejb\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- filterSet.addFilter("testLibraries",testLibraries.toString()); //$NON-NLS-1$
- filterSet.addFilter("requiredProjects",requiredProjects.toString()); //$NON-NLS-1$
- File testTemplateDir = null;
- try {
- testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"test"); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
- AntCopyUtils.FileSet excludeCvsSvn
- = new AntCopyUtils.FileSet(CVS_SVN).dir(testTemplateDir);
-
- AntCopyUtils.copyFilesAndFolders(
- testTemplateDir,
- testProjectDir,
- new AntCopyUtils.FileSetFileFilter(excludeCvsSvn),
- new FilterSetCollection(filterSet), true);
-
- excludeCvsSvn.dir(new File(seamRuntime.getHomeDir(),"embedded-ejb/conf")); //$NON-NLS-1$
- AntCopyUtils.copyFiles(
- new File(seamRuntime.getHomeDir(),"embedded-ejb/conf"), //$NON-NLS-1$
- embededEjbDir,
- new AntCopyUtils.FileSetFileFilter(excludeCvsSvn));
-
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(testProjectDir,"test-src/META-INF/persistence.xml"), //$NON-NLS-1$
- new FilterSetCollection(filterSet), true);
-
- AntCopyUtils.copyFileToFolder(
- jbossBeansFile,
- new File(testProjectDir,"test-src/META-INF"), //$NON-NLS-1$
- new FilterSetCollection(filterSet), true);
-
- AntCopyUtils.copyFiles(
- new File(seamRuntime.getHomeDir(),"lib"), //$NON-NLS-1$
- testLibDir,
- new AntCopyUtils.FileSetFileFilter(includeLibs));
-
- createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
- }
-
- /**
- * @param seamGenResFolder
- */
- private void createComponentsProperties(final File seamGenResFolder, String projectName, Boolean embedded) {
- Properties components = new Properties();
- String prefix = "".equals(projectName)?"":projectName+"/"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- components.put("embeddedEjb", embedded.toString()); //$NON-NLS-1$
- components.put("jndiPattern", prefix+"#{ejbName}/local"); //$NON-NLS-1$ //$NON-NLS-2$
- File componentsProps = new File(seamGenResFolder,"components.properties"); //$NON-NLS-1$
- try {
- componentsProps.createNewFile();
- components.store(new FileOutputStream(componentsProps), ""); //$NON-NLS-1$
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.project.facet.core.IActionConfigFactory#create()
- */
- public Object create() throws CoreException {
- // TODO Auto-generated method stub
- return null;
- }
-}
17 years, 2 months
JBoss Tools SVN: r4393 - trunk/documentation/development.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-10-19 18:40:49 -0400 (Fri, 19 Oct 2007)
New Revision: 4393
Added:
trunk/documentation/development/.project
Log:
Added: trunk/documentation/development/.project
===================================================================
--- trunk/documentation/development/.project (rev 0)
+++ trunk/documentation/development/.project 2007-10-19 22:40:49 UTC (rev 4393)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.doc.development</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
17 years, 2 months
JBoss Tools SVN: r4392 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-19 15:45:50 -0400 (Fri, 19 Oct 2007)
New Revision: 4392
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1030
Banners for Seam wizards were updated
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-10-19 18:46:00 UTC (rev 4391)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-10-19 19:45:50 UTC (rev 4392)
@@ -15,6 +15,7 @@
import java.util.Map;
import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.INewWizard;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -24,6 +25,7 @@
public SeamConversationWizard() {
super(CREATE_SEAM_CONVERSATION);
setWindowTitle(SeamUIMessages.SEAM_CONVERSATION_WIZARD_CREATE_NEW_CONVERSATION);
+ setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamConversationWizard.class, "SeamWebProjectWizBan.png"));
addPage(new SeamConversationWizardPage1());
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-10-19 18:46:00 UTC (rev 4391)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-10-19 19:45:50 UTC (rev 4392)
@@ -15,6 +15,7 @@
import java.util.Map;
import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.INewWizard;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -31,6 +32,7 @@
public SeamEntityWizard() {
super(CREATE_SEAM_ENTITY);
setWindowTitle(SeamUIMessages.SEAM_ENTITY_WIZARD_NEW_SEAM_ENTITY);
+ setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamEntityWizard.class, "SeamWebProjectWizBan.png"));
addPage(new SeamEntityWizardPage1());
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-10-19 18:46:00 UTC (rev 4391)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-10-19 19:45:50 UTC (rev 4392)
@@ -28,6 +28,7 @@
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.INewWizard;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.seam.core.SeamProjectsSet;
@@ -46,6 +47,7 @@
public SeamGenerateEnitiesWizard() {
super(GENERATE_SEAM_ENTITIES);
setWindowTitle(SeamUIMessages.GENERATE_SEAM_ENTITIES_WIZARD_TITLE);
+ setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(SeamGenerateEnitiesWizard.class, "SeamWebProjectWizBan.png"));
addPage(new SeamGenerateEnitiesWizardPage());
}
17 years, 2 months
JBoss Tools SVN: r4391 - in trunk/seam/plugins/org.jboss.tools.seam.ui: resources/org/jboss/tools/seam/ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-19 14:46:00 -0400 (Fri, 19 Oct 2007)
New Revision: 4391
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project_new.gif
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamActionWizBan.png
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamFormWizBan.png
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamWebProjectWizBan.png
Log:
http://jira.jboss.org/jira/browse/JBIDE-1030
Icons for Seam wizards, actions and views were updated
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project.gif
===================================================================
(Binary files differ)
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/seam_project_new.gif
===================================================================
(Binary files differ)
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamActionWizBan.png
===================================================================
(Binary files differ)
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamFormWizBan.png
===================================================================
(Binary files differ)
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamWebProjectWizBan.png
===================================================================
(Binary files differ)
17 years, 2 months
JBoss Tools SVN: r4389 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test: src/org/jboss/tools/jsf/vpe/richfaces/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-10-19 12:24:10 -0400 (Fri, 19 Oct 2007)
New Revision: 4389
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
Log:
org.jboss.tools.jsf.vpe.richfaces.test improvement
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF 2007-10-19 15:53:58 UTC (rev 4388)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF 2007-10-19 16:24:10 UTC (rev 4389)
@@ -9,5 +9,6 @@
org.jboss.tools.vpe,
org.junit,
org.eclipse.core.resources,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.jboss.tools.common
Eclipse-LazyStart: true
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java 2007-10-19 15:53:58 UTC (rev 4388)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java 2007-10-19 16:24:10 UTC (rev 4389)
@@ -14,14 +14,15 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin {
+public class Activator extends BaseUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.jsf.vpe.richfaces.test";
@@ -41,8 +42,8 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
+ super.start(context);
+ plugin = this;
}
/*
@@ -51,8 +52,8 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
+ plugin = null;
+ super.stop(context);
}
/**
@@ -61,18 +62,22 @@
* @return the shared instance
*/
public static Activator getDefault() {
- return plugin;
+ return plugin;
}
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+
public static String getPluginResourcePath() {
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- URL url = null;
- try {
- url = bundle == null ? null : FileLocator.resolve(bundle
- .getEntry("/resources"));
- } catch (Exception e) {
- url = bundle.getEntry("/resources");
+ Bundle bundle = Platform.getBundle(PLUGIN_ID);
+ URL url = null;
+ try {
+ url = bundle == null ? null : FileLocator.resolve(bundle
+ .getEntry("/resources"));
+ } catch (Exception e) {
+ url = bundle.getEntry("/resources");
+ }
+ return (url == null) ? null : url.getPath();
}
- return (url == null) ? null : url.getPath();
- }
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java 2007-10-19 15:53:58 UTC (rev 4388)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java 2007-10-19 16:24:10 UTC (rev 4389)
@@ -36,75 +36,76 @@
*
*/
public class ImportRichFacesComponents {
- private static final String PROJECT_NAME = "richFacesTest";
- private static final String COMPONENTS_PATH = "WebContent/pages";
+ private static final String PROJECT_NAME = "RichFacesTest"; // $NON-NLS-1$
+ private static final String COMPONENTS_PATH = "WebContent/pages"; // $NON-NLS-1$
@SuppressWarnings("restriction")
- public static boolean importRichFacesPages(String path) {
- boolean result = false;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- ZipLeveledStructureProvider zipStructureProvider;
- try {
- zipStructureProvider = new ZipLeveledStructureProvider(new ZipFile(
- path));
+ public static boolean importRichFacesPages(String path) {
+ boolean result = false;
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ ZipLeveledStructureProvider zipStructureProvider;
+ try {
+ zipStructureProvider =
+ new ZipLeveledStructureProvider(new ZipFile(path));
- IOverwriteQuery overwrite = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return ALL;
- }
- };
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
- ImportOperation importOp = new ImportOperation(project
- .getFullPath(), zipStructureProvider.getRoot(),
- zipStructureProvider, overwrite);
+ ImportOperation importOp = new ImportOperation(
+ project.getFullPath(),
+ zipStructureProvider.getRoot(),
+ zipStructureProvider,
+ overwrite);
- importOp.setContext(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell());
+ importOp.setContext(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- importOp.run(new NullProgressMonitor());
- result = true;
+ importOp.run(new NullProgressMonitor());
+ result = true;
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (InvocationTargetException ite) {
+ Activator.getPluginLog().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+ Activator.getPluginLog().logError(ie);
+ } catch (IOException e) {
+ Activator.getPluginLog().logError(e);
+ }
+ return result;
}
- return result;
- }
/**
- *
- * @return
- * @throws CoreException
- */
+ *
+ * @return
+ * @throws CoreException
+ */
public static Collection<IPath> getComponentsPaths() throws CoreException {
- Collection<IPath> result = null;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- if (project != null) {
- IFolder folder = project.getFolder(COMPONENTS_PATH);
- IResource[] resources = folder.members();
- if (resources != null && resources.length > 0) {
- result = new ArrayList<IPath>(resources.length);
- for (IResource res : resources) {
- result.add(res.getFullPath());
+ Collection<IPath> result = null;
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ if (project != null) {
+ IFolder folder = project.getFolder(COMPONENTS_PATH);
+ IResource[] resources = folder.members();
+ if (resources != null && resources.length > 0) {
+ result = new ArrayList<IPath>(resources.length);
+ for (IResource res : resources) {
+ result.add(res.getFullPath());
+ }
+ }
}
- }
+ return result;
}
- return result;
- }
/**
*
* @throws CoreException
*/
public static void removeProject() throws CoreException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
- }
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ }
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2007-10-19 15:53:58 UTC (rev 4388)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2007-10-19 16:24:10 UTC (rev 4389)
@@ -34,118 +34,114 @@
*/
public class RichFacesComponentTest extends TestCase implements ILogListener {
- private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor";
- private final static String TEST_PROJECT_JAR_PATH = "/richFacesTest.jar";
-
- // check warning log
- private final static boolean checkWarning = false;
- private boolean failureLog;
- private Collection<IPath> components = null;
+ private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
+ private final static String TEST_PROJECT_JAR_PATH = "/richFacesTest.jar"; // $NON-NLS-1$
- public RichFacesComponentTest(String name) {
- super(name);
- }
+ // check warning log
+ private final static boolean checkWarning = false;
+ private boolean failureLog;
+ private Collection<IPath> components = null;
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- *
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- if (ImportRichFacesComponents.importRichFacesPages(Activator
- .getPluginResourcePath()
- + TEST_PROJECT_JAR_PATH)) {
- components = ImportRichFacesComponents.getComponentsPaths();
+ public RichFacesComponentTest(String name) {
+ super(name);
}
- failureLog = false;
- waitForJobs();
- Platform.addLogListener(this);
- waitForJobs();
- delay(5000);
- }
- /**
- * Perform post-test cleanup.
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- ImportRichFacesComponents.removeProject();
- waitForJobs();
- Platform.removeLogListener(this);
- }
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (ImportRichFacesComponents.importRichFacesPages(Activator
+ .getPluginResourcePath() + TEST_PROJECT_JAR_PATH)) {
+ components = ImportRichFacesComponents.getComponentsPaths();
+ }
+ failureLog = false;
+ waitForJobs();
+ Platform.addLogListener(this);
+ waitForJobs();
+ delay(5000);
+ }
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- private void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
+ /**
+ * Perform post-test cleanup.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ ImportRichFacesComponents.removeProject();
+ waitForJobs();
+ Platform.removeLogListener(this);
}
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ private void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
}
- }
- /**
- * Wait until all background tasks are complete.
- */
- public void waitForJobs() {
- while (Platform.getJobManager().currentJob() != null)
- delay(5000);
- }
+ /**
+ * Wait until all background tasks are complete.
+ */
+ public void waitForJobs() {
+ while (Platform.getJobManager().currentJob() != null)
+ delay(5000);
+ }
- public void testRichFacesComponent() throws PartInitException {
- waitForJobs();
-
- for (IPath componentPath : components) {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
- componentPath);
- IEditorInput input = new FileEditorInput(file);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage().openEditor(input, EDITOR_ID, true);
+ public void testRichFacesComponent() throws PartInitException {
+ waitForJobs();
- waitForJobs();
- delay(3000);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage().closeAllEditors(true);
- }
- assertEquals(failureLog, false);
- }
+ for (IPath componentPath : components) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(componentPath);
+ IEditorInput input = new FileEditorInput(file);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, EDITOR_ID, true);
- public void logging(IStatus status, String plugin) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- failureLog = true;
- break;
- case IStatus.WARNING:
- if (checkWarning)
- failureLog = true;
- break;
- default:
- break;
+ waitForJobs();
+ delay(3000);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
+ }
+ assertEquals(failureLog, false);
}
- }
+ public void logging(IStatus status, String plugin) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ failureLog = true;
+ break;
+ case IStatus.WARNING:
+ if (checkWarning)
+ failureLog = true;
+ break;
+ default:
+ break;
+ }
+ }
+
}
17 years, 2 months
JBoss Tools SVN: r4388 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-10-19 11:53:58 -0400 (Fri, 19 Oct 2007)
New Revision: 4388
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
Log:
JBIDE-727
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2007-10-19 15:12:09 UTC (rev 4387)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2007-10-19 15:53:58 UTC (rev 4388)
@@ -21,11 +21,13 @@
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.model.ui.IValueChangeListener;
import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
@@ -118,7 +120,7 @@
filter = "java.lang.Object";
}
- tc = new TypeSelectionComponent(parent, 0, message, false, scope, IJavaSearchConstants.CLASS + IJavaSearchConstants.INTERFACE, Signature.getSimpleName(filter), new TitleLabel(), null);
+ tc = new TypeSelectionComponent(parent, 0, message, false, scope, 0/*IJavaSearchConstants.CLASS + IJavaSearchConstants.INTERFACE*/, Signature.getSimpleName(filter), new TitleLabel(), null);
Composite composite = tc;
tc.triggerSearch();
17 years, 2 months
JBoss Tools SVN: r4387 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: widget/editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-10-19 11:12:09 -0400 (Fri, 19 Oct 2007)
New Revision: 4387
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1037
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -279,6 +279,8 @@
public static String SEAM_WIZARD_FACTORY_SEAM_COMPONENT_NAME;
+ public static String SEAM_WIZARD_FACTORY_PACKAGE_NAME;
+
public static String SEAM_WIZARD_FACTORY_SEAM_ENTITY_CLASS_NAME;
public static String SEAM_WIZARD_FACTORY_SEAM_PROJECT;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-10-19 15:12:09 UTC (rev 4387)
@@ -92,6 +92,7 @@
SEAM_INSTALL_WIZARD_PAGE_EDIT=Edit...
SEAM_WIZARD_FACTORY_BEAN_NAME=Bean name:
SEAM_WIZARD_FACTORY_PAGE_NAME=Page name:
+SEAM_WIZARD_FACTORY_PACKAGE_NAME=Package name:
SEAM_ENTITY_WIZARD_PAGE1_LIST=List
SEAM_ENTITY_WIZARD_PAGE1_PAGE=Page
SEAM_FORM_WIZARD_NEW_SEAM_FORM=New Seam Form
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -12,6 +12,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
@@ -37,7 +39,9 @@
private String nameText = null;
Label labelControl = null;
-
+
+ protected Map<Object, Object> data = null;
+
/**
*
* @param name
@@ -49,7 +53,7 @@
this.labelText = label;
this.nameText = name;
}
-
+
/**
*
* @param parent
@@ -58,12 +62,12 @@
Assert.isTrue(parent instanceof Composite, SeamUIMessages.BASE_FIELD_EDITOR_PARENT_CONTROL_SHOULD_BE_COMPOSITE);
Assert.isTrue(((Composite)parent).getLayout() instanceof GridLayout,SeamUIMessages.BASE_FIELD_EDITOR_EDITOR_SUPPORTS_ONLY_GRID_LAYOUT);
Composite aComposite = (Composite) parent;
- Control[] controls = (Control[])getEditorControls(aComposite);
+ getEditorControls(aComposite);
GridLayout gl = (GridLayout)((Composite)parent).getLayout();
-
+
doFillIntoGrid(aComposite,gl.numColumns);
}
-
+
/**
* @param composite
* @param numColumns
@@ -245,4 +249,18 @@
public void setEditable(boolean aEditable) {
this.editable = aEditable;
}
-}
+
+ public Object getData(Object key) {
+ if(data==null) {
+ return null;
+ }
+ return data.get(key);
+ }
+
+ public void setData(Object key, Object value) {
+ if(data==null) {
+ data = new HashMap<Object, Object>();
+ }
+ data.put(key, value);
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -105,7 +105,6 @@
*/
@Override
public int getNumberOfControls() {
- // TODO Auto-generated method stub
return 1;
}
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.core.runtime.Assert;
@@ -32,10 +33,8 @@
public CompositeEditor(String name, String label, Object defaultValue) {
super(name, label, defaultValue);
- // TODO Auto-generated constructor stub
}
-
@Override
public void doFillIntoGrid(Object parent) {
Assert.isTrue(parent instanceof Composite, SeamUIMessages.COMPOSITE_EDITOR_PARENT_CONTROL_SHOULD_BE_COMPOSITE);
@@ -54,14 +53,13 @@
}
List<Control> controls = new ArrayList<Control>();
-
+
@Override
public Object[] getEditorControls() {
if(controls.size()>0) return controls.toArray();
else throw new IllegalStateException(SeamUIMessages.COMPOSITE_EDITOR_THIS_METOD_CAN_BE_INVOKED);
}
-
-
+
@Override
public Object[] getEditorControls(Object parent) {
for (IFieldEditor editor : editors) {
@@ -74,7 +72,7 @@
public int getNumberOfControls() {
return editors.size();
}
-
+
@Override
public boolean isEditable() {
return true;
@@ -88,7 +86,7 @@
}
List<IFieldEditor> editors = new ArrayList<IFieldEditor>();
-
+
public CompositeEditor addFieldEditors(IFieldEditor[] editors) {
this.editors.addAll( Arrays.asList(editors));
for (IFieldEditor editor : Arrays.asList(editors)) {
@@ -96,7 +94,7 @@
}
return this;
}
-
+
@Override
public void setValue(Object newValue) {
for (IFieldEditor editor : editors) {
@@ -117,15 +115,31 @@
}
super.setValue(event.getNewValue());
}
-
+
@Override
public void setEnabled(boolean set) {
for (IFieldEditor editor : editors) {
editor.setEnabled(set);
}
}
-
+
public List<IFieldEditor> getEditors() {
return Collections.unmodifiableList(editors);
}
-}
+
+ public IFieldEditor getEditorByName(String name) {
+ for (IFieldEditor editor : editors) {
+ if(name.equals(editor.getName())) {
+ return editor;
+ }
+ }
+ return null;
+ }
+
+ public void setData(Object key, Object value) {
+ super.setData(key, value);
+ for (IFieldEditor editor : editors) {
+ editor.setData(key, value);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -84,6 +84,19 @@
*
*/
public void dispose();
-
-}
+
+ /**
+ * Sets the application defined property of this editor
+ * @param data
+ * @param key
+ */
+ public void setData(Object data, Object key);
+
+ /**
+ * Gets the application defined property of this editor
+ * @param key
+ * @return
+ */
+ public Object getData(Object key);
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -129,4 +129,4 @@
List values, Object defaultValue, boolean flat,
ButtonPressedAction action1,
IValidator validator);
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -38,9 +38,6 @@
return editor;
}
- /**
- *
- */
/*
* Starting from 4022 revision it creates standart combo box, if it be necessary
* to use custom combo box, use another implementation of this method.
@@ -60,7 +57,7 @@
TaggedComboFieldEditor editor = new TaggedComboFieldEditor(name,label,values, defaultValue,editable);
return editor;
}
-
+
/**
*
*/
@@ -70,7 +67,7 @@
new TextFieldEditor(name,label, defaultValue)});
return editor;
}
-
+
/**
*
*/
@@ -80,7 +77,7 @@
new TextFieldEditor(name,label, defaultValue,false)});
return editor;
}
-
+
/**
*
*/
@@ -91,8 +88,7 @@
new ButtonFieldEditor(name,createSelectFolderAction(SeamUIMessages.SWT_FIELD_EDITOR_FACTORY_BROWS),defaultValue)});
return editor;
}
-
-
+
/**
*
*/
@@ -103,8 +99,7 @@
new ButtonFieldEditor(name,createSelectFileAction(SeamUIMessages.SWT_FIELD_EDITOR_FACTORY_BROWS),defaultValue)});
return editor;
}
-
-
+
public IFieldEditor createButtonFieldEditor(String name, String label, String defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator ) {
CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
@@ -112,8 +107,8 @@
new ButtonFieldEditor(name,action,defaultValue)});
return editor;
}
+
/**
- *
* @param buttonName
* @return
*/
@@ -132,7 +127,7 @@
}
};
}
-
+
/**
*
* @param buttonName
@@ -167,7 +162,7 @@
}
};
}
-
+
/**
*
*/
@@ -184,8 +179,7 @@
});
return editor;
}
-
-
+
/**
*
*/
@@ -201,4 +195,4 @@
});
return editor;
}
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -16,22 +16,21 @@
*
*/
public interface IParameter {
-
+
public static String SEAM_PROJECT_NAME = "seam.project.name"; //$NON-NLS-1$
public static String SEAM_COMPONENT_NAME = "component.name"; //$NON-NLS-1$
public static String SEAM_LOCAL_INTERFACE_NAME = "interface.name"; //$NON-NLS-1$
public static String SEAM_BEAN_NAME = "bean.name"; //$NON-NLS-1$
public static String SEAM_METHOD_NAME = "method.name"; //$NON-NLS-1$
+ public static String SEAM_PACKAGE_NAME = "seam.package.name"; //$NON-NLS-1$
public static String SEAM_PAGE_NAME = "page.name"; //$NON-NLS-1$
public static String SEAM_MASTER_PAGE_NAME = "masterPage.name"; //$NON-NLS-1$
public static String SEAM_ENTITY_CLASS_NAME = "entity.name"; //$NON-NLS-1$
public static String SEAM_PROJECT_LOCATION_PATH = "seam.project.location"; //$NON-NLS-1$
public static String SEAM_PROJECT_WEBCONTENT_PATH = "seam.project.webcontent"; //$NON-NLS-1$
public static String HIBERNATE_CONFIGURATION_NAME = "hibernate.configuratrion.name"; //$NON-NLS-1$
-
+
public static String SEAM_EAR_PROJECT_LOCATION_PATH = "seam.ear.project.location"; //$NON-NLS-1$
public static String SEAM_TEST_PROJECT_LOCATION_PATH = "seam.test.project.location"; //$NON-NLS-1$
public static String SEAM_EJB_PROJECT_LOCATION_PATH = "seam.ejb.project.location"; //$NON-NLS-1$
-
-
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -59,11 +59,11 @@
else
return ACTION_EAR_MAPPING;
}
-
+
public static final List<String[]> ACTION_WAR_MAPPING = new ArrayList<String[]>();
-
+
public static final List<String[]> ACTION_EAR_MAPPING = new ArrayList<String[]>();
-
+
static {
// initialize war files mapping
ACTION_WAR_MAPPING.add(new String[]{
@@ -78,7 +78,7 @@
ACTION_WAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME + "}/seam-gen/view/action.xhtml", //$NON-NLS-1$ //$NON-NLS-2$
"${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" + IParameter.SEAM_PAGE_NAME +"}.xhtml"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
// initialize ear files mapping
ACTION_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME + "}/seam-gen/src/ActionBean.java", //$NON-NLS-1$ //$NON-NLS-2$
@@ -95,4 +95,4 @@
ACTION_EAR_MAPPING.add(ACTION_WAR_MAPPING.get(3));
}
};
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -78,37 +78,36 @@
Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
-
+
Map<String, Object> vars = new HashMap<String, Object>();
IEclipsePreferences seamFacetPrefs = SeamCorePlugin.getSeamPreferences(project);
SeamProjectsSet seamPrjSet = new SeamProjectsSet(project);
-
+
try {
-
for (String key : seamFacetPrefs.keys()) {
vars.put(key, seamFacetPrefs.get(key, "")); //$NON-NLS-1$
}
-
+
for (Object valueHolder : params.values()) {
INamedElement elem = (INamedElement)valueHolder;
vars.put(elem.getName(),elem.getValue().toString());
}
-
+
loadCustomVariables(vars);
-
+
String actionFolder = vars.get(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString();
String entityFolder = vars.get(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME).toString();
String testFolder = vars.get(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME).toString();
-
+
IVirtualComponent com = ComponentCore.createComponent(project);
IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
IContainer webRootContainer = webRootFolder.getUnderlyingFolder();
-
+
vars.put(ISeamFacetDataModelProperties.SEAM_PROJECT_INSTANCE,project);
vars.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME, SeamRuntimeManager.getInstance().getRuntimeForProject(project).getHomeDir());
vars.put(IParameter.SEAM_PROJECT_LOCATION_PATH,project.getLocation().toFile().toString());
vars.put(IParameter.SEAM_PROJECT_WEBCONTENT_PATH,webRootContainer.getLocation().toFile().toString());
-
+
vars.put(IParameter.SEAM_EJB_PROJECT_LOCATION_PATH,seamPrjSet.getEjbProject()!=null?seamPrjSet.getEjbProject().getLocation().toFile().toString():"");
vars.put(IParameter.SEAM_TEST_PROJECT_LOCATION_PATH,seamPrjSet.getTestProject().getLocation().toFile().toString());
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH, actionFolder.replace('.','/'));
@@ -117,7 +116,7 @@
vars.put(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, testFolder);
vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_PATH, entityFolder.replace('.','/'));
vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, entityFolder);
-
+
List<String[]> fileMapping = getFileMappings(vars);
List<String[]> fileMappingCopy = applayVariables(fileMapping,vars);
FilterSetCollection filters = getFilterSetCollection(vars);
@@ -145,7 +144,6 @@
}
}
});
-
} catch (CoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
} catch (BackingStoreException e) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -316,6 +316,12 @@
setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL);
}
}
+ if(event.getPropertyName().equals(IParameter.SEAM_PROJECT_NAME)) {
+ IFieldEditor editor = getEditor(IParameter.SEAM_PACKAGE_NAME);
+ if(editor!=null) {
+ editor.setData(IParameter.SEAM_PROJECT_NAME, event.getNewValue());
+ }
+ }
}
/**
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -21,7 +21,6 @@
import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
-import org.jboss.tools.seam.ui.widget.editor.SwtFieldEditorFactory;
/**
* @author eskimo
@@ -39,7 +38,6 @@
* @return
*/
public static IFieldEditor createSeamLocalInterfaceNameFieldEditor() {
- // TODO Auto-generated method stub
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_LOCAL_INTERFACE_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_LOCAL_INTERFACE_NAME, ""); //$NON-NLS-1$
}
@@ -50,7 +48,6 @@
public static IFieldEditor createSeamBeanNameFieldEditor() {
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_BEAN_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_BEAN_NAME, ""); //$NON-NLS-1$
-
}
/**
@@ -59,7 +56,6 @@
public static IFieldEditor createSeamMethodNameFieldEditor() {
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_METHOD_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_METHOD_NAME, ""); //$NON-NLS-1$
-
}
/**
@@ -92,8 +88,16 @@
/**
* @return
*/
+ public static IFieldEditor createSeamJavaPackageSelectionFieldEditor(String defaultSelection) {
+ return IFieldEditorFactory.INSTANCE.createButtonFieldEditor(
+ IParameter.SEAM_PACKAGE_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_PACKAGE_NAME, defaultSelection,
+ new SelectJavaPackageAction(), ValidatorFactory.NO_ERRORS_VALIDATOR);
+ }
+
+ /**
+ * @return
+ */
public static IFieldEditor createSeamComponentNameFieldEditor() {
- // TODO Auto-generated method stub
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_COMPONENT_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_SEAM_COMPONENT_NAME, ""); //$NON-NLS-1$
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -0,0 +1,103 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.SeamProjectsSet;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
+import org.jboss.tools.seam.ui.SeamUIMessages;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SelectJavaPackageAction extends ButtonFieldEditor.ButtonPressedAction {
+
+ public SelectJavaPackageAction() {
+ super(SeamUIMessages.SELECT_SEAM_PROJECT_ACTION_BROWSE);
+ }
+
+ @Override
+ public void run() {
+ String projectName = (String)getFieldEditor().getData(IParameter.SEAM_PROJECT_NAME);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if(project == null) {
+ SeamGuiPlugin.getPluginLog().logError("Can't find java project with name: " + projectName);
+ return;
+ }
+ SeamProjectsSet seamPrjSet = new SeamProjectsSet(project);
+ IProject ejbProject = seamPrjSet.getEjbProject();
+ if(ejbProject!=null) {
+ project = ejbProject;
+ }
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+ if(javaProject == null) {
+ SeamGuiPlugin.getPluginLog().logError("Can't find java project with name: " + projectName);
+ return;
+ }
+ IPackageFragmentRoot packageFragmentRoot = null;
+ IPackageFragmentRoot[] roots;
+ try {
+ roots = javaProject.getPackageFragmentRoots();
+ for (int i = 0; i < roots.length; i++) {
+ if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
+ packageFragmentRoot = roots[i];
+ break;
+ }
+ }
+ } catch (JavaModelException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ if (packageFragmentRoot == null) {
+ packageFragmentRoot = javaProject.getPackageFragmentRoot(javaProject.getResource());
+ }
+ if (packageFragmentRoot == null) {
+ SeamGuiPlugin.getPluginLog().logError("Can't find src folder for project " + projectName);
+ return;
+ }
+ IJavaElement[] packages = null;
+ try {
+ packages = packageFragmentRoot.getChildren();
+ } catch (JavaModelException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ if (packages == null) {
+ packages = new IJavaElement[0];
+ }
+
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(Display.getCurrent().getActiveShell(), new JavaElementLabelProvider(
+ JavaElementLabelProvider.SHOW_DEFAULT));
+ dialog.setTitle(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_TITLE);
+ dialog.setMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_DESC);
+ dialog.setEmptyListMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_MSG_NONE);
+ dialog.setElements(packages);
+ if (dialog.open() == Window.OK) {
+ IPackageFragment fragment = (IPackageFragment) dialog.getFirstResult();
+ if (fragment != null) {
+ getFieldEditor().setValue(fragment.getElementName());
+ } else {
+ getFieldEditor().setValue("");
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-10-19 14:52:59 UTC (rev 4386)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-10-19 15:12:09 UTC (rev 4387)
@@ -26,7 +26,6 @@
*/
public SelectSeamProjectAction() {
super(SeamUIMessages.SELECT_SEAM_PROJECT_ACTION_BROWSE);
- // TODO Auto-generated constructor stub
}
@Override
17 years, 2 months