Author: dgolovin
Date: 2007-08-01 21:13:09 -0400 (Wed, 01 Aug 2007)
New Revision: 2812
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
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/AntCopyUtils.java
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.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/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
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/ComboFieldEditor.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/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/widget/field/ComboBoxField.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-603
DTP Connection prifile selection added. It allows change exists or create new connection
profile for JDBC Connection.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-08-01 17:01:46
UTC (rev 2811)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-08-02 01:13:09
UTC (rev 2812)
@@ -27,7 +27,12 @@
org.eclipse.jface.text,
org.eclipse.jdt.launching,
org.eclipse.wst.sse.core,
- org.eclipse.wst.xml.core
+ org.eclipse.wst.xml.core,
+ org.eclipse.datatools.connectivity,
+ org.eclipse.datatools.connectivity.db.generic,
+ org.eclipse.datatools.connectivity.db.generic.ui,
+ org.eclipse.datatools.connectivity.ui,
+ org.eclipse.datatools.connectivity.ui.dse
Provide-Package: org.jboss.tools.seam.core,
org.jboss.tools.seam.internal.core,
org.jboss.tools.seam.internal.core.scanner,
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-08-01 17:01:46 UTC (rev
2811)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-08-02 01:13:09 UTC (rev
2812)
@@ -94,6 +94,14 @@
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>
</extension>
<extension
point="org.eclipse.wst.common.project.facet.core.runtimes">
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2007-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -185,4 +185,19 @@
}
}
}
+
+ public static void copyFiles(String[] files, File dest) {
+ for (String fileName : files) {
+ File file = new File(fileName);
+ if(file.exists() && file.isFile()) {
+ copyFileToFolder(file, dest, null, true);
+ } else {
+ try {
+ SeamCorePlugin.getPluginLog().logError("Cannot copy JDBC driver jar '"
+ file.getCanonicalPath() + "'");
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ }
}
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -24,6 +24,8 @@
public static final String SEAM_PROJECT_INSTANCE = "seam.project.instance";
+ public static final String SEAM_CONNECTION_PROFILE =
"seam.project.connection.profile";
+
public static final String JBOSS_AS_HOME = "jboss.home";
public static final String JBOSS_AS_DEPLOY_AS =
"seam.project.deployment.type";
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -43,7 +43,8 @@
PROJECT_TEMPLATE.addFilter("driverJar","${driver.file}");
PROJECT_TEMPLATE.addFilter("jndiPattern","${project.name}/#{ejbName}/local");
PROJECT_TEMPLATE.addFilter("embeddedEjb","false");
-
+ PROJECT_TEMPLATE.addFilter("debug","true");
+
FILTERS_TEMPLATE = new FilterSet();
FILTERS_TEMPLATE.addFilter("interfaceName","${interface.name}");
FILTERS_TEMPLATE.addFilter("beanName","${bean.name}");
@@ -59,11 +60,8 @@
FILTERS_TEMPLATE.addFilter("homeName","${component.name}Home");
FILTERS_TEMPLATE.addFilter("query","${query.text}");
-
HIBERNATE_DIALECT_TEMPLATE = new FilterSet();
HIBERNATE_DIALECT_TEMPLATE.addFilter("hibernate.dialect","${hibernate.dialect}");
-
-
}
public static FilterSet createJdbcFilterSet(IDataModel values) {
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 2007-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -69,6 +69,7 @@
names.add(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME);
names.add(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER);
names.add(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);
+ names.add(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE);
return names;
}
Modified:
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -200,7 +200,6 @@
final File dataSourceDsFile = new File(seamGenResFolder,
"datasource-ds.xml");
final File componentsFile = new
File(seamGenResFolder,"WEB-INF/components"+(isWarConfiguration(model)?"-war":"")+".xml");
- final File jdbcDriverFile = new
File(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH).toString());
final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder,
"hibernatetools/hibernate-console.launch");
final File hibernateConsolePropsFile = new File(seamGenHomeFolder,
"hibernatetools/hibernate-console.properties");
final File hibernateConsolePref = new File(seamGenHomeFolder,
"hibernatetools/.settings/org.hibernate.eclipse.console.prefs");
@@ -255,12 +254,6 @@
hibernateDialectFilterSet, true);
//
********************************************************************************************
- // Copy JDBC driver if there is any
- //
********************************************************************************************
- if(jdbcDriverFile.exists())
- AntCopyUtils.copyFileToFolder(jdbcDriverFile, webLibFolder, true);
-
- //
********************************************************************************************
// Handle WAR/EAR configurations
//
********************************************************************************************
if(isWarConfiguration(model)) {
@@ -302,8 +295,9 @@
new File(project.getLocation().toFile(),project.getName()+".launch"),
new FilterSetCollection(projectFilterSet), true);
- if(jdbcDriverFile.exists())
- AntCopyUtils.copyFileToFolder(jdbcDriverFile, webLibFolder, true);
+ // Copy JDBC driver if there is any
+ AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH),
webLibFolder);
+
} else {
@@ -394,13 +388,9 @@
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)));
- //
********************************************************************************************
// Copy JDBC driver if there is any
- //
********************************************************************************************
- if(jdbcDriverFile.exists())
- AntCopyUtils.copyFileToFolder(jdbcDriverFile, earContentsFolder, true);
+ AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH),
earContentsFolder);
-
ear.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (IOException e) {
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreInstallDelegate.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.internal.core.project.facet;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.drivers.DriverManager;
+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;
+
+public class SeamFacetPreInstallDelegate implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ IDataModel model = (IDataModel)config;
+ IConnectionProfile connProfile =
ProfileManager.getInstance().getProfileByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE).toString());
+ Properties props =
connProfile.getProperties("org.eclipse.datatools.connectivity.db.generic.connectionProfile");
+
+ // Collect properties name from DTP Connection Profile
+ model.setProperty(ISeamFacetDataModelProperties.DB_USER_NAME,props.get("org.eclipse.datatools.connectivity.db.username").toString());
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_CLASS_NAME,props.get("org.eclipse.datatools.connectivity.db.driverClass").toString());
+ model.setProperty(ISeamFacetDataModelProperties.DB_USERP_PASSWORD,props.get("org.eclipse.datatools.connectivity.db.password").toString());
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_URL_FOR_DB,props.get("org.eclipse.datatools.connectivity.db.URL").toString());
+ model.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH,DriverManager.getInstance().getDriverInstanceByID(
+ props.get("org.eclipse.datatools.connectivity.driverDefinitionID").toString()).getJarListAsArray());
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-08-01 17:01:46
UTC (rev 2811)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-08-02 01:13:09
UTC (rev 2812)
@@ -41,7 +41,11 @@
org.eclipse.jst.j2ee.web,
org.eclipse.wst.xml.ui,
org.apache.ant,
- org.jboss.ide.eclipse.jdt.core
+ org.jboss.ide.eclipse.jdt.core,
+ org.eclipse.datatools.connectivity,
+ org.eclipse.datatools.connectivity.ui.dse,
+ org.eclipse.datatools.connectivity.db.generic.ui,
+ org.eclipse.datatools.connectivity.db.generic
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.seam.ui,
org.jboss.tools.seam.ui.builder,
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-08-01 17:01:46 UTC (rev
2811)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-08-02 01:13:09 UTC (rev
2812)
@@ -37,7 +37,7 @@
</wizard>
<wizard
category="org.jboss.tools.seam.ui"
- class="org.jboss.tools.seam.ui.wizard.SeamFofrmWizard"
+ class="org.jboss.tools.seam.ui.wizard.SeamFormWizard"
icon="icons/view/component_new.gif"
id="org.jboss.tools.seam.ui.wizard2"
name="Seam Form">
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -12,31 +12,40 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.IPropertySetChangeEvent;
+import org.eclipse.datatools.connectivity.IPropertySetListener;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
+import org.eclipse.datatools.connectivity.ui.dse.dialogs.ProfileSelectionComposite;
+import org.eclipse.jdt.internal.core.SetVariablesOperation;
import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ListDialog;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.internal.dialogs.PropertyDialog;
import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
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.ITaggedFieldEditor;
@@ -62,10 +71,7 @@
*/
DataModelValidatorDelegate validatorDelegate;
- // General group
- // IFieldEditor jBossAsHomeEditor =
IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
- // ISeamFacetDataModelProperties.JBOSS_AS_HOME,
- // "JBoss AS Home Folder:","C:\\java\\jboss-4.0.5.GA");
+
IFieldEditor jBossSeamHomeEditor =
IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
"JBoss Seam Home
Folder:",SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
@@ -73,10 +79,18 @@
ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
"Deploy as:",Arrays.asList(new
String[]{"war","ear"}),"war",false);
+ String lastCreatedCPName = "";
+
// Database group
+ IFieldEditor connProfileSelEditor =
IFieldEditorFactory.INSTANCE.createComboWithTwoButtons(
+ ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, "Connection profile",
+ getProfileNameList(), "", true,
+ new EditConnectionProfileAction(),
+ new NewConnectionProfileAction(),
+ ValidatorFactory.NO_ERRORS_VALIDATOR);
IFieldEditor jBossAsDbTypeEditor = IFieldEditorFactory.INSTANCE.createComboEditor(
ISeamFacetDataModelProperties.DB_TYPE,
- "Database
Type:",Arrays.asList(HIBERNATE_HELPER.getDialectNames()),"HSQL");
+ "Database
Type:",Arrays.asList(HIBERNATE_HELPER.getDialectNames()),"HSQL",true);
IFieldEditor jBossHibernateDialectEditor =
IFieldEditorFactory.INSTANCE.createUneditableTextEditor(
ISeamFacetDataModelProperties.HIBERNATE_DIALECT,
"Hibernate Dialect:",HIBERNATE_HELPER.getDialectClass("HSQL"));
@@ -98,10 +112,10 @@
"User Password:", "password");
IFieldEditor dbSchemaName = IFieldEditorFactory.INSTANCE.createTextEditor(
ISeamFacetDataModelProperties.DB_SCHEMA_NAME,
- "Database Schema Name:", "schema-name");
+ "Database Schema Name:", "");
IFieldEditor dbCatalogName = IFieldEditorFactory.INSTANCE.createTextEditor(
ISeamFacetDataModelProperties.DB_CATALOG_NAME,
- "Database Catalog Name:", "catalog-name");
+ "Database Catalog Name:", "");
IFieldEditor dbTablesExists = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
ISeamFacetDataModelProperties. DB_ALREADY_EXISTS,
"DB Tables already exists in database:", false);
@@ -177,7 +191,6 @@
*
*/
public void createControl(Composite parent) {
- // TODO Auto-generated method stub
initializeDialogUnits(parent);
Composite root = new Composite(parent, SWT.NONE);
GridData gd = new GridData();
@@ -195,7 +208,6 @@
gridLayout = new GridLayout(3, false);
generalGroup.setLayout(gridLayout);
-// registerEditor(jBossAsHomeEditor,generalGroup, 3);
registerEditor(jBossSeamHomeEditor,generalGroup, 3);
registerEditor(jBossAsDeployAsEditor,generalGroup, 3);
@@ -208,21 +220,24 @@
Group databaseGroup = new Group(root,SWT.NONE);
databaseGroup.setLayoutData(gd);
databaseGroup.setText("Database");
- gridLayout = new GridLayout(3, false);
+ gridLayout = new GridLayout(4, false);
databaseGroup.setLayout(gridLayout);
- registerEditor(jBossAsDbTypeEditor,databaseGroup, 3);
- registerEditor(jBossHibernateDialectEditor,databaseGroup, 3);
- registerEditor(jdbcDriverClassname,databaseGroup, 3);
- registerEditor(jdbcUrlForDb,databaseGroup,3);
- registerEditor(dbUserName,databaseGroup, 3);
- registerEditor(dbUserPassword,databaseGroup, 3);
- registerEditor(dbSchemaName,databaseGroup, 3);
- registerEditor(dbCatalogName,databaseGroup, 3);
- registerEditor(dbTablesExists,databaseGroup, 3);
- registerEditor(recreateTablesOnDeploy,databaseGroup, 3);
- registerEditor(pathToJdbcDriverJar,databaseGroup, 3);
-
+ registerEditor(jBossAsDbTypeEditor,databaseGroup, 4);
+ registerEditor(jBossHibernateDialectEditor,databaseGroup, 4);
+ registerEditor(connProfileSelEditor,databaseGroup,4);
+ registerEditor(dbSchemaName,databaseGroup, 4);
+ registerEditor(dbCatalogName,databaseGroup, 4);
+ registerEditor(dbTablesExists,databaseGroup, 4);
+ registerEditor(recreateTablesOnDeploy,databaseGroup, 4);
+ //registerEditor(pathToJdbcDriverJar,databaseGroup, 4);
+
Group generationGroup = new Group(root,SWT.NONE);
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = false;
+
generationGroup.setLayoutData(gd);
generationGroup.setText("Code Generation");
gridLayout = new GridLayout(3, false);
@@ -230,35 +245,12 @@
registerEditor(sessionBeanPkgNameditor,generationGroup, 3);
registerEditor(entityBeanPkgNameditor,generationGroup, 3);
registerEditor(testsPkgNameditor,generationGroup, 3);
-
+
setControl(root);
validatorDelegate.addValidatorForProperty(jBossSeamHomeEditor.getName(),
ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR);
-// validatorDelegate.addValidatorForProperty(jBossAsHomeEditor.getName(),
ValidatorFactory.JBOSS_AS_HOME_FOLDER_VALIDATOR);
validatorDelegate.addValidatorForProperty(pathToJdbcDriverJar.getName(),
ValidatorFactory.FILESYSTEM_FILE_EXISTS_VALIDATOR);
-
- jBossAsDbTypeEditor.addPropertyChangeListener(new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- jBossHibernateDialectEditor.setValue(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString()));
- jdbcDriverClassname.setTags(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString())));
- }
- });
-
- jdbcDriverClassname.addPropertyChangeListener(new PropertyChangeListener(){
- public void propertyChange(PropertyChangeEvent evt) {
- if(evt.getNewValue()==null) {
- jdbcUrlForDb.setTags(new String[]{});
- } else {
- String[] connectionUrls =
HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString());
- String[] newUrls = new String[connectionUrls.length];
- int i = 0;
- for (String string : connectionUrls) {
- newUrls[i++] = string.replace("<",
"").replace(">", "");
- }
- jdbcUrlForDb.setTags(newUrls);
- }
- }
- });
+ validatorDelegate.addValidatorForProperty(connProfileSelEditor.getName(),ValidatorFactory.CONNECTION_PROFILE_IS_NOT_SELECTED);
}
/**
@@ -273,4 +265,84 @@
}
}
+
+ // Utils method
+ private List<String> getProfileNameList() {
+ IConnectionProfile[] profiles =
ProfileManager.getInstance().getProfilesByCategory(ProfileSelectionComposite.JDBC_CATEGORY);
+ List<String> names = new ArrayList<String>();
+ for (IConnectionProfile connectionProfile : profiles) {
+ names.add(connectionProfile.getName());
+ }
+ return names;
+ }
+
+ public class EditConnectionProfileAction extends ButtonFieldEditor.ButtonPressedAction
{
+
+ /**
+ * @param label
+ */
+ public EditConnectionProfileAction() {
+ super("Edit...");
+ }
+
+ @Override
+ public void run() {
+ IConnectionProfile selectedProfile =
ProfileManager.getInstance().getProfileByName(getFieldEditor().getValue().toString());
+ String oldName = getFieldEditor().getValue().toString();
+
+ if(selectedProfile==null) return;
+ PropertyDialog.createDialogOn(Display.getCurrent().getActiveShell(),
+ "org.eclipse.datatools.connectivity.db.generic.profileProperties",
selectedProfile).open();
+
+ if(!oldName.equals(selectedProfile.getName())) {
+ getFieldEditor().setValue(selectedProfile.getName());
+ ((ITaggedFieldEditor)((CompositeEditor)connProfileSelEditor).getEditors().get(1)).setTags(getProfileNameList().toArray(new
String[0]));
+ oldName = selectedProfile.getName();
+ }
+ }
+ };
+
+ public class NewConnectionProfileAction extends ButtonFieldEditor.ButtonPressedAction {
+ /**
+ * @param label
+ */
+ public NewConnectionProfileAction() {
+ super("New...");
+ }
+
+ @Override
+ public void run() {
+ NewConnectionProfileWizard wizard = new NewConnectionProfileWizard() {
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.datatools.connectivity.ui.wizards.NewConnectionProfileWizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ // create profile only
+ try {
+ ProfileManager.getInstance().createProfile(
+ getProfileName()==null?"":getProfileName(),
+ getProfileDescription()==null?"":getProfileDescription(),
+ mProviderID,
+ getProfileProperties(),
+ mProfilePage.getRepository()==null?"":mProfilePage.getRepository().getName(),
+ false);
+ lastCreatedCPName = getProfileName();
+ } catch (ConnectionProfileException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+
+ return true;
+ }};
+ wizard.initProviderID(IDBConnectionProfileConstants.CONNECTION_PROFILE_ID);
+ WizardDialog wizardDialog = new
WizardDialog(Display.getCurrent().getActiveShell(),wizard);
+ wizardDialog.open();
+
+ if(wizardDialog.getReturnCode() != WizardDialog.CANCEL) {
+ getFieldEditor().setValue(lastCreatedCPName);
+ ((ITaggedFieldEditor)((CompositeEditor)connProfileSelEditor).getEditors().get(1)).setTags(getProfileNameList().toArray(new
String[0]));
+ }
+ }
+ };
}
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -308,4 +308,13 @@
return NO_ERRORS;
}
};
+
+ public static IValidator CONNECTION_PROFILE_IS_NOT_SELECTED = new IValidator() {
+ public Map<String, String> validate(Object value, Object context) {
+ if(value==null || "".equals(value.toString().trim())) {
+ return createErrormessage("Connection profile is not selected.");
+ }
+ return NO_ERRORS;
+ }
+ };
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2007-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -81,7 +81,7 @@
* @see
org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
*/
public void setTags(String[] tags) {
- comboField.setTags(tags);
+ comboField.setTags(tags,getValueAsString());
}
/* (non-Javadoc)
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -7,6 +7,7 @@
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import javax.rmi.CORBA.ValueHandler;
@@ -41,7 +42,7 @@
for(int i=0;i<controls.length;i++) {
GridData gd = new GridData();
- gd.horizontalSpan = controls.length-1==i?gl.numColumns-i:1;
+ gd.horizontalSpan = i==1?gl.numColumns-controls.length+1:1;
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = (i==1);
controls[i].setLayoutData(gd);
@@ -113,4 +114,8 @@
editor.setEnabled(set);
}
}
+
+ public List<IFieldEditor> getEditors() {
+ return Collections.unmodifiableList(editors);
+ }
}
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.widget.editor;
import java.util.List;
@@ -15,11 +15,13 @@
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
public interface IFieldEditorFactory {
-
+
public static final IFieldEditorFactory INSTANCE = new SwtFieldEditorFactory();
+
/**
*
- * @param name TODO
+ * @param name
+ * TODO
* @param label
* @param defaultValue
* @return
@@ -28,33 +30,38 @@
/**
*
- * @param name TODO
+ * @param name
+ * TODO
* @param label
* @param values
* @param defaultValue
* @return
*/
- ITaggedFieldEditor createComboEditor(String name, String label, List values, Object
defaultValue);
+ ITaggedFieldEditor createComboEditor(String name, String label,
+ List values, Object defaultValue);
/**
*
- * @param name TODO
+ * @param name
+ * TODO
* @param label
* @param values
* @param defaultValue
* @return
*/
- ITaggedFieldEditor createComboEditor(String name, String label, List values, Object
defaultValue, boolean flat);
+ ITaggedFieldEditor createComboEditor(String name, String label,
+ List values, Object defaultValue, boolean flat);
-
/**
*
- * @param name TODO
+ * @param name
+ * TODO
* @param label
* @param defaultValue
* @return
*/
- IFieldEditor createCheckboxEditor(String name, String label, boolean defaultValue);
+ IFieldEditor createCheckboxEditor(String name, String label,
+ boolean defaultValue);
/**
*
@@ -63,8 +70,9 @@
* @param defaultValue
* @return
*/
- IFieldEditor createBrowseFolderEditor(String name, String label, String defaultValue);
-
+ IFieldEditor createBrowseFolderEditor(String name, String label,
+ String defaultValue);
+
/**
*
* @param name
@@ -72,8 +80,9 @@
* @param defaultValue
* @return
*/
- IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue);
-
+ IFieldEditor createBrowseFileEditor(String name, String label,
+ String defaultValue);
+
/**
* @param jdbcDriverClassName
* @param string
@@ -82,7 +91,7 @@
*/
IFieldEditor createUneditableTextEditor(String jdbcDriverClassName,
String string, String string2);
-
+
/**
*
* @param name
@@ -92,6 +101,26 @@
* @param validator
* @return
*/
- public IFieldEditor createButtonFieldEditor(String name, String label, String
defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator );
+ public IFieldEditor createButtonFieldEditor(String name, String label,
+ String defaultValue, ButtonFieldEditor.ButtonPressedAction action,
+ IValidator validator);
+ /**
+ *
+ * @param name
+ * @param label
+ * @param values
+ * @param defaultValue
+ * @param flat
+ * @param action1
+ * @param action2
+ * @param validator
+ * @return
+ */
+ public IFieldEditor createComboWithTwoButtons(String name, String label,
+ List values, Object defaultValue, boolean flat,
+ ButtonFieldEditor.ButtonPressedAction action1,
+ ButtonFieldEditor.ButtonPressedAction action2, IValidator validator);
+
+ public ButtonFieldEditor.ButtonPressedAction createNotImplementedYetAction(String
buttonName);
}
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-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -12,10 +12,18 @@
import java.util.List;
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
/**
*
@@ -145,4 +153,33 @@
}
};
}
+
+
+ public ButtonFieldEditor.ButtonPressedAction createNotImplementedYetAction(String
buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ new MessageDialog(Display.getCurrent().getActiveShell(), "Error",
+ null, "Not implemented yet", MessageDialog.ERROR, new
String[]{"Ok"},1)
+ .open();
+ }
+ };
+ }
+ /**
+ *
+ */
+ public IFieldEditor createComboWithTwoButtons(String name, String label,
+ List values, Object defaultValue, boolean flat,
+ ButtonPressedAction action1, ButtonPressedAction action2,
+ IValidator validator) {
+ CompositeEditor editor = new
CompositeEditor("seam.project.connection.profile","Connection
Profile",null);
+ editor.addFieldEditors(new IFieldEditor[]{
+ new LabelFieldEditor(name,label),
+ new ComboFieldEditor(name,label, values, defaultValue, false),
+ new ButtonFieldEditor(name, action1, defaultValue),
+ new ButtonFieldEditor(name, action2, defaultValue)
+ });
+ return editor;
+ }
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -40,7 +40,12 @@
ComboViewer comboControl = null;
List values = new ArrayList();
-
+ public ComboBoxField(Composite parent,List values, ILabelProvider labelProvider,
+ Object value, boolean floatStyle) {
+ this(parent, values, value, floatStyle);
+
+ comboControl.setLabelProvider(labelProvider);
+ }
public ComboBoxField(Composite parent,List values, Object value, boolean floatStyle) {
this.values = values;
comboControl = new ComboViewer(parent,floatStyle?SWT.FLAT:SWT.READ_ONLY);
@@ -117,11 +122,11 @@
comboControl.getCombo().setText(newValue.toString());
}
- public void setTags(String[] tags) {
+ public void setTags(String[] tags,String value) {
values = Arrays.asList(tags);
comboControl.removeSelectionChangedListener(this);
comboControl.refresh(true);
comboControl.addPostSelectionChangedListener(this);
- comboControl.setSelection(new StructuredSelection(tags.length>0?tags[0]:new
String[]{}));
+ comboControl.setSelection(new StructuredSelection(value));
}
}
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java 2007-08-01
17:01:46 UTC (rev 2811)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.wizard;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.INewWizard;
-import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-
-/**
- *
- * @author eskimo
- *
- */
-public class SeamFofrmWizard extends SeamBaseWizard implements INewWizard {
-
- /**
- *
- */
- public SeamFofrmWizard() {
- super(CREATE_SEAM_FORM);
- setWindowTitle("New Seam Form");
- addPage(new SeamFormWizardPage1());
- }
-
- private static IUndoableOperation CREATE_SEAM_FORM = new SeamFormCreateOperation();
-
- public static class SeamFormCreateOperation extends SeamBaseOperation {
-
- public SeamFormCreateOperation() {
- super("Form creating operation");
- }
-
- public File getBeanFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"src/FormActionJavaBean.java");
- }
-
- public File getTestClassFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"test/FormTest.java");
- }
-
- public File getTestngXmlFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"test/testng.xml");
- }
-
- public File getPageXhtml(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"view/form.xhtml");
- }
-
- /* (non-Javadoc)
- * @see
org.jboss.tools.seam.ui.wizard.SeamBaseOperation#getFileMappings(java.util.Map)
- */
- @Override
- public List<String[]> getFileMappings(Map<String, Object> vars) {
- if("war".equals(vars.get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)))
- return FORM_WAR_MAPPING;
- else
- return FORM_EAR_MAPPING;
- }
-
- public static final List<String[]> FORM_WAR_MAPPING = new
ArrayList<String[]>();
-
- public static final List<String[]> FORM_EAR_MAPPING = new
ArrayList<String[]>();
-
- static {
- FORM_WAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormActionJavaBean.java",
- "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
- FORM_WAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/FormTest.java",
- "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH + "}/${"+
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.java"});
- FORM_WAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/testng.xml",
- "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH + "}/${"+
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.xml"});
- FORM_WAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/view/form.xhtml",
- "${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" +
IParameter.SEAM_PAGE_NAME +"}.xhtml"});
-
- // initialize ear files mapping
- FORM_EAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormActionBean.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
- FORM_EAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormAction.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
- FORM_EAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/FormTest.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH +
"}/${"+ IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.java"});
- FORM_EAR_MAPPING.add(new String[]{
- "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/testng.xml",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH +
"}/${"+ IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.xml"});
- FORM_EAR_MAPPING.add(FORM_WAR_MAPPING.get(3));
- }
- };
-}
Copied:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
(from rev 2745,
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java)
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2007-08-02
01:13:09 UTC (rev 2812)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.INewWizard;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class SeamFormWizard extends SeamBaseWizard implements INewWizard {
+
+ /**
+ *
+ */
+ public SeamFormWizard() {
+ super(CREATE_SEAM_FORM);
+ setWindowTitle("New Seam Form");
+ addPage(new SeamFormWizardPage1());
+ }
+
+ private static IUndoableOperation CREATE_SEAM_FORM = new SeamFormCreateOperation();
+
+ public static class SeamFormCreateOperation extends SeamBaseOperation {
+
+ public SeamFormCreateOperation() {
+ super("Form creating operation");
+ }
+
+ public File getBeanFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"src/FormActionJavaBean.java");
+ }
+
+ public File getTestClassFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"test/FormTest.java");
+ }
+
+ public File getTestngXmlFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"test/testng.xml");
+ }
+
+ public File getPageXhtml(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"view/form.xhtml");
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.seam.ui.wizard.SeamBaseOperation#getFileMappings(java.util.Map)
+ */
+ @Override
+ public List<String[]> getFileMappings(Map<String, Object> vars) {
+ if("war".equals(vars.get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)))
+ return FORM_WAR_MAPPING;
+ else
+ return FORM_EAR_MAPPING;
+ }
+
+ public static final List<String[]> FORM_WAR_MAPPING = new
ArrayList<String[]>();
+
+ public static final List<String[]> FORM_EAR_MAPPING = new
ArrayList<String[]>();
+
+ static {
+ FORM_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormActionJavaBean.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
+ FORM_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/FormTest.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH + "}/${"+
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.java"});
+ FORM_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/testng.xml",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH + "}/${"+
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.xml"});
+ FORM_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/view/form.xhtml",
+ "${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" +
IParameter.SEAM_PAGE_NAME +"}.xhtml"});
+
+ // initialize ear files mapping
+ FORM_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormActionBean.java",
+ "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
+ FORM_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormAction.java",
+ "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
+ FORM_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/FormTest.java",
+ "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH +
"}/${"+ IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.java"});
+ FORM_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/testng.xml",
+ "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH +
"}/${"+ IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.xml"});
+ FORM_EAR_MAPPING.add(FORM_WAR_MAPPING.get(3));
+ }
+ };
+}