[jbosstools-commits] JBoss Tools SVN: r6681 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Mar 4 13:02:59 EST 2008
Author: akazakov
Date: 2008-03-04 13:02:59 -0500 (Tue, 04 Mar 2008)
New Revision: 6681
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/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1322 New settings are created for new projects that we create by New Seam Web Project.
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 2008-03-04 14:44:06 UTC (rev 6680)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2008-03-04 18:02:59 UTC (rev 6681)
@@ -15,34 +15,50 @@
/**
* Seam facet properties collected in Seam Web Project Wizard.
- * Only properties listed below are saved in Seam WebProject Preferences:
+ * Only properties listed below are saved in Seam WebProject Preferences:
+ * ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER,
* ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME,
- * ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME
- * ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE
- * ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS
- * ISeamFacetDataModelProperties.SEAM_TEST_PROJECT
- * ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME
- * ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME
- * ISeamFacetDataModelProperties.SEAM_EJB_PROJECT
+ * ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER,
+ * ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
+ * ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
+ * ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
+ * ISeamFacetDataModelProperties.SEAM_TEST_PROJECT,
+ * ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ * ISeamFacetDataModelProperties.SEAM_SETTINGS_VERSION,
+ * ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER,
+ * ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
+ * ISeamFacetDataModelProperties.TEST_CREATING,
+ * ISeamFacetDataModelProperties.SEAM_EJB_PROJECT,
* ISeamFacetDataModelProperties.SEAM_EAR_PROJECT
* @author eskimo
- *
*/
public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
-
+
// Seam Preferences names constants
-
+
/**
+ * Source folder used session objects: actions, forms, conversations, beans
+ * web pages backing beans
+ */
+ String SESSION_BEAN_SOURCE_FOLDER = "action.sources"; //$NON-NLS-1$
+
+ /**
* Package name used session objects: actions, forms, conversations, beans
* web pages backing beans
*/
- String SESION_BEAN_PACKAGE_NAME = "action.package"; //$NON-NLS-1$
+ String SESSION_BEAN_PACKAGE_NAME = "action.package"; //$NON-NLS-1$
/**
+ * Source folder used entity beans: actions, forms, conversations, beans
+ * web pages backing beans
+ */
+ String ENTITY_BEAN_SOURCE_FOLDER = "model.sources"; //$NON-NLS-1$
+
+ /**
* Package name for Entity Beans classes
*/
String ENTITY_BEAN_PACKAGE_NAME = "model.package"; //$NON-NLS-1$
-
+
/**
* Connection profile name
*/
@@ -57,7 +73,7 @@
* Test project name that was created for Seam Web Project
*/
String SEAM_TEST_PROJECT = "seam.test.project"; //$NON-NLS-1$
-
+
/**
* Seam runtime name that should be used to create seam artifacts:
* forms, actions, conversations and entities
@@ -65,29 +81,50 @@
String SEAM_RUNTIME_NAME = "seam.runtime.name"; //$NON-NLS-1$
/**
+ * Seam settings version.
+ */
+ String SEAM_SETTINGS_VERSION = "seam.project.settings.version";
+
+ /**
+ * Seam settings version 1.1.
+ */
+ String SEAM_SETTINGS_VERSION_1_1 = "1.1";
+
+ /**
+ * Source folder where tests for seam artifacts should be placed inside the
+ * test project
+ */
+ String TEST_SOURCE_FOLDER = "test.sources"; //$NON-NLS-1$
+
+ /**
* Package where tests for seam artifacts should be placed inside the
* test project
*/
String TEST_CASES_PACKAGE_NAME = "test.package"; //$NON-NLS-1$
-
+
/**
+ * This flag indicates that we should create seam tests.
+ * Can be "true" or "false".
+ */
+ String TEST_CREATING = "seam.test.creating"; //$NON-NLS-1$
+
+ /**
* Ejb project name created from Seam Web Project in EAR deployment configuration
*/
String SEAM_EJB_PROJECT = "seam.ejb.project"; //$NON-NLS-1$
-
+
/**
* Ear project name created for Seam Web Project in EAR deployment configuration
*/
String SEAM_EAR_PROJECT = "seam.ear.project"; //$NON-NLS-1$
+ // Seam Facet Wizard Page parameters constants
- // Seam Facet Wizard Page parameters constants
-
/**
* Project name token
*/
String SEAM_PROJECT_NAME = "project.name"; //$NON-NLS-1$
-
+
/**
* Selected Seam Project
*/
@@ -97,37 +134,37 @@
* Path to JBoss AS server
*/
String JBOSS_AS_HOME = "jboss.home"; //$NON-NLS-1$
-
+
/**
* Selected Database type
*/
String DB_TYPE = "database.type"; //$NON-NLS-1$
-
+
/**
* Selected hibernate dialect
*/
String HIBERNATE_DIALECT = "hibernate.dialect"; //$NON-NLS-1$
-
+
/**
* JDBC driver class name token
*/
String JDBC_DRIVER_CLASS_NAME = "hibernate.connection.driver_class"; //$NON-NLS-1$
-
+
/**
* JDBC Connection URL token
*/
String JDBC_URL_FOR_DB = "hibernate.connection.url"; //$NON-NLS-1$
-
+
/**
* Connection user name token
*/
String DB_USER_NAME = "hibernate.connection.username"; //$NON-NLS-1$
-
+
/**
* Connection user name password
*/
String DB_USER_PASSWORD = "hibernate.connection.password"; //$NON-NLS-1$
-
+
/**
* Schema name
*/
@@ -140,42 +177,42 @@
*
*/
String DB_DEFAULT_SCHEMA_NAME = "hibernate.default_schema"; //$NON-NLS-1$
-
+
/**
* Catalog name
*/
String DB_CATALOG_NAME = "catalog.property"; //$NON-NLS-1$
-
+
/**
* If it is empty catalog.property is empty
* If is not empty catalog.property should be set to
* 
 <property name="hibernate.default_catalog" value="${hibernate.default_catalog}"/>
*/
String DB_DEFAULT_CATALOG_NAME = "hibernate.default_catalog"; //$NON-NLS-1$
-
+
/**
* DB tables already exists in database check box value
*/
String DB_ALREADY_EXISTS = "database.exists"; //$NON-NLS-1$
-
+
/**
* Recreate database tables and data on deploy check box value
*/
String RECREATE_TABLES_AND_DATA_ON_DEPLOY = "database.drop"; //$NON-NLS-1$
-
+
/**
* TODO
*/
String HIBERNATE_HBM2DDL_AUTO = "hibernate.hbm2ddl.auto"; //$NON-NLS-1$
-
+
/**
* Driver file name
*/
String JDBC_DRIVER_JAR_PATH = "driver.file"; //$NON-NLS-1$
-
+
// TODO: should be moved to org.jboss.tools.seam.ui.wizard.IParameter
// why is this a property when it is always derivable from sesion_bean_package_name ?
- String SESION_BEAN_PACKAGE_PATH = "action.package.path"; //$NON-NLS-1$
+ String SESSION_BEAN_PACKAGE_PATH = "action.package.path"; //$NON-NLS-1$
// TODO: should be moved to org.jboss.tools.seam.ui.wizard.IParameter
// why is this a property when it is always derivable from entity_bean_package_name ?
@@ -189,30 +226,29 @@
* Selected Seam Runtime home folder
*/
String JBOSS_SEAM_HOME = "seam.home.folder"; //$NON-NLS-1$
-
+
/**
* Seam project web contents root folder
*/
String WEB_CONTENTS_FOLDER = "seam.project.web.root.folder"; //$NON-NLS-1$
-
+
/**
* WAR deployment constant
*/
String DEPLOY_AS_WAR = "war"; //$NON-NLS-1$
-
+
/**
* EAR deployment constant
*/
String DEPLOY_AS_EAR = "ear"; //$NON-NLS-1$
-
+
/**
* Selected Server Runtime
*/
String JBOSS_AS_TARGET_SERVER = "seam.project.deployment.target"; //$NON-NLS-1$
-
+
/**
* Selected Server
*/
String JBOSS_AS_TARGET_RUNTIME = "seam.project.deployment.runtime"; //$NON-NLS-1$
-
-}
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-03-04 14:44:06 UTC (rev 6680)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-03-04 18:02:59 UTC (rev 6681)
@@ -11,17 +11,26 @@
package org.jboss.tools.seam.internal.core.project.facet;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
+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.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.osgi.service.prefs.BackingStoreException;
/**
*
@@ -96,7 +105,6 @@
* @see org.eclipse.wst.common.project.facet.core.IActionConfigFactory#create()
*/
public Object create() throws CoreException {
- // TODO Auto-generated method stub
return null;
}
@@ -105,4 +113,56 @@
errorOccurs = true;
}
}
-}
+
+ /**
+ * @param project
+ * @param model
+ */
+ protected 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_SETTINGS_VERSION, SEAM_SETTINGS_VERSION_1_1);
+ prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
+ prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+ prefs.put(SESSION_BEAN_PACKAGE_NAME, model.getProperty(SESSION_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(TEST_CREATING, "true");
+
+ String testSrcPath = project.getFullPath().removeLastSegments(1).append(project.getName() + "-test").append("test-src").toString();
+ prefs.put(TEST_SOURCE_FOLDER, testSrcPath);
+
+ 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$
+
+ String srcPath = project.getFullPath().removeLastSegments(1).append(project.getName() + "-ejb").append("ejbModule").toString();
+ prefs.put(ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER, srcPath);
+ prefs.put(ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER, srcPath);
+ } else {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IPath srcRootFolder = component.getRootFolder().getFolder(new Path("/WEB-INF/classes")).getUnderlyingFolder().getParent().getFullPath(); //$NON-NLS-1$
+
+ prefs.put(ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER, srcRootFolder.append("model").toString());
+ prefs.put(ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER, srcRootFolder.append("action").toString());
+ }
+
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-03-04 14:44:06 UTC (rev 6680)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-03-04 18:02:59 UTC (rev 6681)
@@ -63,9 +63,13 @@
names.add(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
// Code generation group
- names.add(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER);
+ names.add(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER);
names.add(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER);
names.add(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.TEST_CREATING);
names.add(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER);
names.add(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);
names.add(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-03-04 14:44:06 UTC (rev 6680)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-03-04 18:02:59 UTC (rev 6681)
@@ -31,7 +31,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.wst.common.componentcore.ComponentCore;
@@ -61,12 +60,12 @@
*
**/
public static final String DEV_WAR_PROFILE = "dev-war"; //$NON-NLS-1$
-
+
/**
*
*/
public static final String DEV_EAR_PROFILE = "dev"; //$NON-NLS-1$
-
+
/**
*
*/
@@ -76,7 +75,7 @@
*
*/
public static final String TEST_EAR_PROFILE = "test"; //$NON-NLS-1$
-
+
/**
*
*/
@@ -119,7 +118,7 @@
.include("thirdparty-all\\.jar") //$NON-NLS-1$
.exclude(".*/CVS") //$NON-NLS-1$
.exclude(".*/\\.svn"); //$NON-NLS-1$
-
+
/**
*
*/
@@ -180,7 +179,7 @@
.exclude(".*/.*\\.ftl") //$NON-NLS-1$
.exclude(".*/CVS") //$NON-NLS-1$
.exclude(".*/\\.svn"); //$NON-NLS-1$
-
+
/**
*
*/
@@ -252,10 +251,10 @@
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) {
@@ -265,10 +264,9 @@
} else if (dbRecreate) {
model.setProperty(ISeamFacetDataModelProperties.HIBERNATE_HBM2DDL_AUTO, "create-drop"); //$NON-NLS-1$
}
-
+
final String consoleName = isWarConfiguration(model) ? project.getName() : project.getName() + "-ejb";
-
-
+
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$
@@ -280,29 +278,29 @@
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
// ****************************************************************
@@ -310,52 +308,49 @@
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)));
@@ -366,20 +361,20 @@
// ********************************************************************************************
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"), srcFolder, true); //$NON-NLS-1$
final IContainer source = srcRootFolder.getUnderlyingFolder();
-
+
IPath actionSrcPath = new Path(source.getFullPath().removeFirstSegments(1) + "/action"); //$NON-NLS-1$
IPath modelSrcPath = new Path(source.getFullPath().removeFirstSegments(1) + "/model"); //$NON-NLS-1$
srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
WtpUtils.createSourceFolder(project, actionSrcPath, source.getFullPath().removeFirstSegments(1), webRootFolder.getFullPath().removeFirstSegments(1).append("WEB-INF/dev")); //$NON-NLS-1$
WtpUtils.createSourceFolder(project, modelSrcPath, source.getFullPath().removeFirstSegments(1), 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().removeFirstSegments(1) + "/action/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/') + "/" + "Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new File(project.getLocation().toFile(), source.getFullPath().removeFirstSegments(1) + "/action/" + model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.', '/') + "/" + "Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new FilterSetCollection(filtersFilterSet), true);
AntCopyUtils.copyFileToFile(
@@ -392,23 +387,22 @@
dataSourceDsFile,
new File(resources, 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$
+ WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor); //$NON-NLS-1$
} 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)));
@@ -419,7 +413,7 @@
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$
@@ -431,66 +425,63 @@
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 File(ejb, "ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESSION_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.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$
@@ -501,23 +492,21 @@
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)));
-
-
+
File resources = new File(ear, "resources");
AntCopyUtils.copyFileToFile(
dataSourceDsFile,
new File(resources, project.getName() + "-ds.xml"), //$NON-NLS-1$ //$NON-NLS-2$
viewFilterSetCollection, true);
-
+
try {
-
File[] earJars = earContentsFolder.listFiles(new FilenameFilter() {
/* (non-Javadoc)
* @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
@@ -530,7 +519,7 @@
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$
@@ -541,20 +530,18 @@
} 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);
toggleHibernateOnProject(project, consoleName);
-
+
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
String wsPath = project.getLocation().removeLastSegments(1)
.toFile().getAbsoluteFile().getPath();
@@ -562,26 +549,22 @@
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");
toggleHibernateOnProject(ejbProjectToBeImported, consoleName);
IProjectFacet sf = ProjectFacetsManager.getProjectFacet("jst.ejb");
IProjectFacetVersion pfv = ProjectFacetsManager.create(ejbProjectToBeImported).getInstalledVersion(sf);
ClasspathHelper.addClasspathEntries(ejbProjectToBeImported, pfv);
-
+
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");
toggleHibernateOnProject(testProjectToBeImported, consoleName);
-
}
-
/**
*
* @param model
@@ -590,121 +573,78 @@
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$
+
+ 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().getFullPath().removeFirstSegments(1).toString()); //$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 {
- prefs.flush();
- } catch (BackingStoreException e) {
+ 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);
- 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().getFullPath().removeFirstSegments(1).toString()); //$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.copyFiles(
- new File(seamRuntime.getHomeDir(), "lib"), //$NON-NLS-1$
- testLibDir,
- new AntCopyUtils.FileSetFileFilter(includeLibs));
-
- createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
- }
+ 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.copyFiles(
+ new File(seamRuntime.getHomeDir(), "lib"), //$NON-NLS-1$
+ testLibDir,
+ new AntCopyUtils.FileSetFileFilter(includeLibs));
+
+ createComponentsProperties(testSrcDir, "", Boolean.TRUE); //$NON-NLS-1$
+ }
+
/**
*
* @param seamGenResFolder
@@ -724,7 +664,7 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
-
+
/**
*
* @param project
@@ -733,9 +673,9 @@
*/
public static boolean toggleHibernateOnProject(IProject project, String defaultConsoleName) {
IScopeContext scope = new ProjectScope(project);
-
+
Preferences node = scope.getNode("org.hibernate.eclipse.console");
-
+
if (node != null) {
node.putBoolean("hibernate3.enabled", true);
node.put("default.configuration", defaultConsoleName);
@@ -748,7 +688,7 @@
} else {
return false;
}
-
+
try {
addProjectNature(project, "org.hibernate.eclipse.console.hibernateNature", new NullProgressMonitor());
return true;
@@ -756,9 +696,8 @@
SeamCorePlugin.getDefault().logError("Could not activate Hibernate nature on project " + project.getName(), ce);
return false;
}
-
}
-
+
/**
* Add the given project nature to the given project (if it isn't already added).
*
@@ -772,7 +711,7 @@
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException();
}
-
+
if (!project.hasNature(nature)) {
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
@@ -787,5 +726,4 @@
return false;
}
}
-
-}
+}
\ No newline at end of file
More information about the jbosstools-commits
mailing list