Author: akazakov
Date: 2008-10-13 15:08:40 -0400 (Mon, 13 Oct 2008)
New Revision: 10811
Modified:
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/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
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
Modified:
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 2008-10-13
18:41:55 UTC (rev 10810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-13
19:08:40 UTC (rev 10811)
@@ -12,26 +12,13 @@
import java.io.File;
-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.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.javaee.web.WebApp;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.project.facet.SeamRuntime;
-import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
// TODO: why not just *one* global filter set to avoid any missing names ? (assert for it
in our unittests!
public class Seam2FacetInstallDelegate extends SeamFacetAbstractInstallDelegate{
@@ -100,186 +87,25 @@
/*
* (non-Javadoc)
- * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForWar(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#copyFilesToWarProject(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- protected void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ protected void copyFilesToWarProject(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
-
- // 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());
-
- 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 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 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);
-
- configureWebXml(project);
-
- 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));
-
- //
********************************************************************************************
- // Handle WAR configurations
- //
********************************************************************************************
+ super.copyFilesToWarProject(project, fv, model, monitor);
+ final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
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, "", 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.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)));
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);
-
File actionsSrc = new File(project.getLocation().toFile(),
source.getFullPath().removeFirstSegments(1) + "/action/");
-
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "seam.properties"),
actionsSrc, true); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new File(actionsSrc,
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(srcFolder,"META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- File resources = new File(project.getLocation().toFile(),"resources");
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(resources,project.getName()+"-ds.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- // to fix seam2 tests for war deployment
-// File srcModelMetaInf = new
File(project.getLocation().append(modelSrcPath).toFile(),"META-INF");
-// AntCopyUtils.copyFileToFile(
-// dataSourceDsFile,
-// new File(srcModelMetaInf,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$
+ AntCopyUtils.copyFiles(droolsLibFolder, webLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
} else {
- // 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$
}
-
- ClasspathHelper.addClasspathEntries(project, fv);
-
- createSeamProjectPreferenes(project, model);
-
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
-
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
/*
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-10-13
18:41:55 UTC (rev 10810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-13
19:08:40 UTC (rev 10811)
@@ -17,9 +17,12 @@
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.IProjectDescription;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
@@ -33,6 +36,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
@@ -59,8 +63,12 @@
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCoreMessages;
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;
import org.osgi.service.prefs.Preferences;
@@ -238,6 +246,26 @@
}
}
+ protected IVirtualFolder srcRootFolder;
+ protected File seamHomeFolder;
+ protected String seamHomePath;
+ protected File seamLibFolder;
+ protected File seamGenResFolder;
+ protected File srcFolder;
+ protected File webContentFolder;
+ protected File webLibFolder;
+ protected IContainer webRootFolder;
+ protected File seamGenHomeFolder;
+ protected File seamGenViewSource;
+ protected File dataSourceDsFile;
+ protected File componentsFile;
+ protected File webInfFolder;
+ protected File webInfClasses;
+ protected File webInfClassesMetaInf;
+ protected File persistenceFile;
+ protected File hibernateConsoleLaunchFile;
+ protected File hibernateConsolePropsFile;
+
/**
*
* @param project
@@ -246,9 +274,60 @@
* @param monitor
* @throws CoreException
*/
- protected abstract void doExecuteForWar(IProject project, IProjectFacetVersion fv,
- IDataModel model, IProgressMonitor monitor) throws CoreException;
+ protected void doExecuteForWar(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ // get WebContents folder path from DWP model
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new
Path("/")); //$NON-NLS-1$
+ srcRootFolder = component.getRootFolder().getFolder(new
Path("/WEB-INF/classes")); //$NON-NLS-1$
+ webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
+
+ 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$
+ }
+
+ webContentFolder = webRootFolder.getLocation().toFile();
+ webInfFolder = new File(webContentFolder, "WEB-INF"); //$NON-NLS-1$
+ webInfClasses = new File(webInfFolder, "classes"); //$NON-NLS-1$
+ webInfClassesMetaInf = new File(webInfClasses, "META-INF"); //$NON-NLS-1$
+ webInfClassesMetaInf.mkdirs();
+ webLibFolder = new File(webContentFolder, WEB_LIBRARIES_RELATED_PATH);
+ srcFolder = isWarConfiguration(model) ? new
File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(), "model") :
srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
+ Object runtimeName =
model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME);
+ final SeamRuntime selectedRuntime =
SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName.toString());
+
+ seamHomePath = selectedRuntime.getHomeDir();
+
+ seamHomeFolder = new File(seamHomePath);
+ seamLibFolder = new File(seamHomePath, SEAM_LIB_RELATED_PATH);
+ seamGenResFolder = new File(seamHomePath, "seam-gen/resources");
//$NON-NLS-1$
+
+ seamGenHomeFolder = new File(seamHomePath, "seam-gen"); //$NON-NLS-1$
+ seamGenViewSource = new File(seamGenHomeFolder, "view"); //$NON-NLS-1$
+ dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml");
//$NON-NLS-1$
+ componentsFile = new File(seamGenResFolder, "WEB-INF/components" +
(isWarConfiguration(model) ? "-war" : "") + ".xml");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ hibernateConsoleLaunchFile = new File(seamGenHomeFolder,
"hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
+ 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$
+ persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" +
(isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml");
//$NON-NLS-1$ //$NON-NLS-2$
+
+ copyFilesToWarProject(project, fv, model, monitor);
+
+ ClasspathHelper.addClasspathEntries(project, fv);
+ createSeamProjectPreferenes(project, model);
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ }
+
/**
*
* @param project
@@ -257,6 +336,124 @@
* @param monitor
* @throws CoreException
*/
+ protected void copyFilesToWarProject(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ 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);
+
+ configureWebXml(project);
+
+ 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));
+
+ //
********************************************************************************************
+ // Handle WAR 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, "", false); //$NON-NLS-1$
//$NON-NLS-2$
+
+ /*AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(project.getLocation().toFile(),".settings"), //$NON-NLS-1$
+ new FilterSetCollection(projectFilterSet), true);*/
+
+ //
********************************************************************************************
+ // Copy seam project indicator
+ //
********************************************************************************************
+
+ 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);
+
+ File actionsSrc = new File(project.getLocation().toFile(),
source.getFullPath().removeFirstSegments(1) + "/action/");
+
+ //AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,
"seam.properties"), actionsSrc, true); //$NON-NLS-1$
+
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
+ new
File(actionsSrc,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(srcFolder, "META-INF/persistence.xml"), //$NON-NLS-1$
+ viewFilterSetCollection, true);
+
+ File resources = new File(project.getLocation().toFile(), "resources");
+ AntCopyUtils.copyFileToFile(
+ 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$
+ } else {
+ // In case of EAR configuration
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,
"messages_en.properties"), srcFolder, true); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @param project
+ * @param fv
+ * @param model
+ * @param monitor
+ * @throws CoreException
+ */
protected abstract void doExecuteForEar(IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException;
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-10-13
18:41:55 UTC (rev 10810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-10-13
19:08:40 UTC (rev 10811)
@@ -19,8 +19,12 @@
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
+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;
/**
* Data model provider for Seam facet wizard page
@@ -140,6 +144,22 @@
"/templates")).getPath()); //$NON-NLS-1$
}
+ /**
+ * Returns default seam runtime name.
+ * @param seamModel
+ * @return
+ */
+ public static String getSeamRuntimeDefaultValue(IDataModel seamModel) {
+ String seamFacetVersion =
seamModel.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString();
+ SeamVersion seamVersion = SeamVersion.parseFromString(seamFacetVersion);
+
+ SeamRuntime defaultRuntime =
SeamRuntimeManager.getInstance().getDefaultRuntime(seamVersion);
+ if(defaultRuntime==null) {
+ return "";
+ }
+ return defaultRuntime.getName();
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider#init()
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-10-13
18:41:55 UTC (rev 10810)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-13
19:08:40 UTC (rev 10811)
@@ -12,32 +12,15 @@
import java.io.File;
-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.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.jst.javaee.core.DisplayName;
import org.eclipse.jst.javaee.core.JavaeeFactory;
import org.eclipse.jst.javaee.web.Filter;
import org.eclipse.jst.javaee.web.WebApp;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.project.facet.SeamRuntime;
-import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
/**
* Install delegate for seam facet version 1.2
@@ -133,177 +116,22 @@
/*
* (non-Javadoc)
- * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForWar(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#copyFilesToWarProject(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- protected void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ protected void copyFilesToWarProject(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
-
- // 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());
-
- 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 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$
-
+ super.copyFilesToWarProject(project, fv, model, monitor);
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 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);
-
- configureWebXml(project);
-
- 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));
-
- //
********************************************************************************************
- // Handle WAR 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, "", 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
- //
********************************************************************************************
-
- 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);
-
- File actionsSrc = new File(project.getLocation().toFile(),
source.getFullPath().removeFirstSegments(1) + "/action/");
-
- //AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,
"seam.properties"), actionsSrc, true); //$NON-NLS-1$
-
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
- new
File(actionsSrc,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(srcFolder, "META-INF/persistence.xml"), //$NON-NLS-1$
- viewFilterSetCollection, true);
-
- File resources = new File(project.getLocation().toFile(), "resources");
- AntCopyUtils.copyFileToFile(
- 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$
} else {
- // 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$
}
-
- ClasspathHelper.addClasspathEntries(project, fv);
-
- createSeamProjectPreferenes(project, model);
-
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
-
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
/*
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 2008-10-13
18:41:55 UTC (rev 10810)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2008-10-13
19:08:40 UTC (rev 10811)
@@ -61,6 +61,7 @@
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.internal.core.project.facet.SeamFacetInstallDataModelProvider;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
@@ -213,21 +214,6 @@
return names;
}
- /**
- *
- * @return
- */
- private Object getSeamRuntimeDefaultValue() {
- String seamFacetVersion =
model.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString();
- SeamVersion seamVersion = SeamVersion.parseFromString(seamFacetVersion);
-
- SeamRuntime defaultRuntime =
SeamRuntimeManager.getInstance().getDefaultRuntime(seamVersion);
- if(defaultRuntime==null) {
- return "";
- }
- return defaultRuntime.getName();
- }
-
private DataModelSynchronizer sync;
/**
@@ -308,7 +294,7 @@
* Creates Seam Facet Wizard Page contents
*/
public void createControl(Composite parent) {
- jBossSeamHomeEditor = SeamWizardFactory.createSeamRuntimeSelectionFieldEditor(new
SeamVersion[0], getSeamRuntimeDefaultValue().toString(), new NewSeamRuntimeAction());
+ jBossSeamHomeEditor = SeamWizardFactory.createSeamRuntimeSelectionFieldEditor(new
SeamVersion[0], SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model), new
NewSeamRuntimeAction());
initializeDialogUnits(parent);
@@ -479,7 +465,7 @@
List<String> runtimes = getRuntimeNames(model.getProperty(
IFacetDataModelProperties.FACET_VERSION_STR).toString());
if (oldValue == null || !runtimes.contains(oldValue)) {
- Object defaultRnt = getSeamRuntimeDefaultValue();
+ Object defaultRnt =
SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model);
if (defaultRnt != null && runtimes.contains(defaultRnt)) {
newValue = defaultRnt;
} else if (runtimes.size() > 0) {
@@ -581,13 +567,12 @@
if(wizard instanceof NewProjectDataModelFacetWizard) {
return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
((NewProjectDataModelFacetWizard)wizard).getDataModel());
}
- return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
model);
-// return new IValidator() {
-// public Map<String, String> validate(Object value, Object context) {
-// SeamInstallWizardPage.this.validate();
-// return ValidatorFactory.NO_ERRORS;
-// }
-// };
+// return new DeploymentTypeValidator(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
model);
+ return new IValidator() {
+ public Map<String, String> validate(Object value, Object context) {
+ return ValidatorFactory.NO_ERRORS;
+ }
+ };
}
static class DeploymentTypeValidator implements IValidator {