Author: dgolovin
Date: 2007-07-17 04:33:03 -0400 (Tue, 17 Jul 2007)
New Revision: 2455
Added:
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/SeamFacetPostInstallDelegate.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.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/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/SeamGuiPlugin.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.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/BaseFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/TextField.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
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/SeamProjectSelectionDialog.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
Log:
http://jira.jboss.org/jira/browse/EXIN-222
Action for WAR configuration is finished
Validation is added
http://jira.jboss.org/jira/browse/EXIN-223
Form for WAR configuration is finished
Validation is added
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-17 08:29:11 UTC (rev
2454)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-17 08:33:03 UTC (rev
2455)
@@ -48,7 +48,7 @@
</project-facet>
<project-facet-version
facet="jst.seam"
- version="2.0">
+ version="1.2">
<constraint>
<and>
<requires
@@ -68,9 +68,9 @@
</project-facet-version>
<action
facet="jst.seam"
- id="jst.seam.2.0.install"
+ id="jst.seam.1.2.install"
type="install"
- version="2.0">
+ version="1.2">
<delegate
class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete">
</delegate>
@@ -80,37 +80,54 @@
</action>
<action
facet="jst.seam"
- id="jst.seam.2.0.uninstall"
+ id="jst.seam.1.2.uninstall"
type="uninstall"
- version="2.0">
+ version="1.2">
<delegate
class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetUninstallDelegate">
</delegate>
</action>
+ <event-handler
+ facet="jst.seam"
+ type="POST_INSTALL"
+ version="[1.2">
+ <delegate
+
class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPostInstallDelegate">
+ </delegate>
+ </event-handler>
</extension>
<extension
point="org.eclipse.wst.common.project.facet.core.runtimes">
<supported>
+ <runtime-component
+ id="org.eclipse.jst.server.generic.runtime.jboss"
+ version="4.2">
+ </runtime-component>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component.40"
+ version="4.0">
+ </runtime-component>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component.42"
+ version="4.2">
+ </runtime-component>
<facet
id="jst.seam"
- version="2.0">
+ version="1.2">
</facet>
- <runtime-component
- any="true">
- </runtime-component>
</supported>
</extension>
<extension
point="org.eclipse.wst.common.project.facet.core.presets">
<static-preset
- id="preset.jst.seam.v2_0">
- <label>Seam 2.0 project</label>
+ id="preset.jst.seam.v1_2">
+ <label>Seam 1.2 project</label>
<facet id="jst.java" version="5.0" />
<facet id="jst.web" version="2.4"/>
<facet id="jst.jsf" version="1.1" />
- <facet id="jst.seam" version="2.0"/>
+ <facet id="jst.seam" version="1.2"/>
<description>
- Seam 2.0 project
+ Seam 1.2 project
</description>
</static-preset>
</extension>
@@ -145,5 +162,5 @@
<super
type="org.eclipse.wst.validation.problemmarker">
</super>
- </extension>
+ </extension>
</plugin>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -11,10 +11,18 @@
package org.jboss.tools.seam.core;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.internal.FacetedProject;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamCoreConstants;
import org.osgi.framework.BundleContext;
/**
@@ -108,4 +116,14 @@
return null;
}
+ public static IEclipsePreferences getSeamFacetPreferences(IProject project) {
+ FacetedProject facetedProject = (FacetedProject)
project.getAdapter(IFacetedProject.class);
+ IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ISeamCoreConstants.SEAM_CORE_FACET_ID);
+ if(facetedProject.hasProjectFacet(facet)) {
+ IScopeContext projectScope = new ProjectScope(project);
+ return projectScope.getNode(PLUGIN_ID);
+ }
+
+ return null;
+ }
}
\ No newline at end of file
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-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -23,13 +23,13 @@
*/
public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
- public static final String PREFIX = "ISeamFacetDataModelProperties.";
-
- public static final String SEAM_PROJECT_NAME = "project.name";
+ public static final String SEAM_PROJECT_NAME = "seam.project.name";
+ public static final String SEAM_PROJECT_INSTANCE = "seam.project.instance";
+
public static final String JBOSS_AS_HOME = "jboss.home";
- public static final String JBOSS_AS_DEPLOY_AS = "JBOSS_AS_DEPLOY_AS";
+ public static final String JBOSS_AS_DEPLOY_AS =
"seam.project.deployment.type";
public static final String DB_TYPE = "database.type";
@@ -59,8 +59,8 @@
public static final String TEST_CASES_PACKAGE_NAME = "test.package";
- public static final String JBOSS_SEAM_HOME = "JBOSS_SEAM_HOME";
+ public static final String JBOSS_SEAM_HOME = "seam.jbossas.home.folder";
- public static final String WEB_CONTENTS_FOLDER = PREFIX +
"WEB_CONTENTS_FOLDER";
+ public static final String WEB_CONTENTS_FOLDER =
"seam.project.web.root.folder";
}
Added:
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
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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.Map;
+
+import org.apache.tools.ant.types.FilterSet;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class SeamFacetFilterSetFactory {
+
+ public static FilterSet JDBC_TEMPLATE;
+ public static FilterSet PROJECT_TEMPLATE;
+ public static FilterSet FILTERS_TEMPLATE;
+ public static FilterSet HIBERNATE_DIALECT_TEMPLATE;
+
+ static {
+ JDBC_TEMPLATE = new FilterSet();
+ JDBC_TEMPLATE.addFilter("jdbcUrl","${hibernate.connection.url}");
+ JDBC_TEMPLATE.addFilter("driverClass","${hibernate.connection.driver_class}");
+ JDBC_TEMPLATE.addFilter("username","${hibernate.connection.username}");
+ JDBC_TEMPLATE.addFilter("password","${hibernate.connection.password}");
+ JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}");
+ JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}");
+
+ PROJECT_TEMPLATE = new FilterSet();
+ PROJECT_TEMPLATE.addFilter("projectName","${project.name}");
+ PROJECT_TEMPLATE.addFilter("jbossHome","${jboss.home}");
+ PROJECT_TEMPLATE.addFilter("hbm2ddl","${hibernate.hbm2ddl.auto}");
+ PROJECT_TEMPLATE.addFilter("driverJar","${driver.file}");
+ PROJECT_TEMPLATE.addFilter("jndiPattern","${project.name}/#{ejbName}/local");
+ PROJECT_TEMPLATE.addFilter("embeddedEjb","false");
+
+ FILTERS_TEMPLATE = new FilterSet();
+ FILTERS_TEMPLATE.addFilter("interfaceName","${interface.name}");
+ FILTERS_TEMPLATE.addFilter("beanName","${bean.name}");
+ FILTERS_TEMPLATE.addFilter("entityName","${entity.name}");
+ FILTERS_TEMPLATE.addFilter("methodName","${method.name}");
+ FILTERS_TEMPLATE.addFilter("componentName","${component.name}");
+ FILTERS_TEMPLATE.addFilter("pageName","${page.name}");
+ FILTERS_TEMPLATE.addFilter("masterPageName","${masterPage.name}");
+ FILTERS_TEMPLATE.addFilter("actionPackage","${action.package}");
+ FILTERS_TEMPLATE.addFilter("modelPackage","${model.package}");
+ FILTERS_TEMPLATE.addFilter("testPackage","${test.package}");
+ FILTERS_TEMPLATE.addFilter("listName","${component.name}List");
+ 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) {
+ return aplayProperties((FilterSet)JDBC_TEMPLATE.clone(), values);
+ }
+ public static FilterSet createProjectFilterSet(IDataModel values){
+ return aplayProperties((FilterSet)PROJECT_TEMPLATE.clone(), values);
+ }
+
+ public static FilterSet createFiltersFilterSet(IDataModel values) {
+ return aplayProperties((FilterSet)FILTERS_TEMPLATE.clone(), values);
+ }
+
+ public static FilterSet createHibernateDialectFilterSet(IDataModel values) {
+ return aplayProperties((FilterSet)HIBERNATE_DIALECT_TEMPLATE.clone(), values);
+ }
+
+ public static FilterSet createFiltersFilterSet(Map values) {
+ return aplayProperties((FilterSet)FILTERS_TEMPLATE.clone(), values);
+ }
+
+ private static FilterSet aplayProperties(FilterSet template,IDataModel values) {
+ FilterSet result = new FilterSet();
+ for (Object filter : template.getFilterHash().keySet()) {
+ String value = template.getFilterHash().get(filter).toString();
+ for (Object property : values.getAllProperties()) {
+ if(value.contains("${"+property.toString()+"}")) {
+ value =
value.replace("${"+property.toString()+"}",values.getProperty(property.toString()).toString());
+ }
+ }
+ result.addFilter(filter.toString(), value);
+ }
+ return result;
+ }
+
+ private static FilterSet aplayProperties(FilterSet template,Map values) {
+ FilterSet result = new FilterSet();
+ for (Object filter : template.getFilterHash().keySet()) {
+ String value = template.getFilterHash().get(filter).toString();
+ for (Object property : values.keySet()){
+ if(value.contains("${"+property.toString()+"}")) {
+ value =
value.replace("${"+property.toString()+"}",values.get(property.toString()).toString());
+ }
+ }
+ result.addFilter(filter.toString(), value);
+ }
+ return result;
+ }
+}
\ No newline at end of file
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-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -98,7 +98,8 @@
.include("jbpm.*\\.jar")
.include("jsf-facelets\\.jar")
.include("oscache.*\\.jar")
- .include("stringtemplate.*\\.jar");
+ .include("stringtemplate.*\\.jar")
+ .include("testng-.*\\.jar");
public static FileSet EAR_LIB_FILESET = new FileSet()
.include("jboss-aop-jdk50\\.jar")
@@ -131,8 +132,6 @@
.include("security\\.drl")
.include("seam\\.properties")
.include("messages_en\\.properties");
- // .include(project.getName()+"ds\\.xml")
- // .include("META-INF/persistence-" + PROFILE + "\\.xml" )
public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib";
@@ -177,9 +176,9 @@
File hibernateConsolePref = new File(seamGenHomeFolder,
"hibernatetools/.settings/org.hibernate.eclipse.console.prefs");
File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" +
PROFILE + ".xml");
- FilterSet jdbcFilterSet = FilterSetFactory.createJdbcFilterSet(model);
- FilterSet projectFilterSet = FilterSetFactory.createProjectFilterSet(model);
- FilterSet filtersFilterSet = FilterSetFactory.createFiltersFilterSet(model);
+ FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+ FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
// ****************************************************************
// Copy view folder from seam-gen installation to WebContent folder
@@ -227,7 +226,7 @@
FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
- hibernateDialectFilterSet.addFilterSet(FilterSetFactory.createHibernateDialectFilterSet(model));
+ hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
AntCopyUtils.copyFileToFolder(
hibernateConsolePropsFile,
@@ -423,82 +422,6 @@
}
}
- public static class FilterSetFactory {
-
- public static FilterSet JDBC_TEMPLATE;
- public static FilterSet PROJECT_TEMPLATE;
- public static FilterSet FILTERS_TEMPLATE;
- public static FilterSet HIBERNATE_DIALECT_TEMPLATE;
-
- static {
- JDBC_TEMPLATE = new FilterSet();
- JDBC_TEMPLATE.addFilter("jdbcUrl","${hibernate.connection.url}");
- JDBC_TEMPLATE.addFilter("driverClass","${hibernate.connection.driver_class}");
- JDBC_TEMPLATE.addFilter("username","${hibernate.connection.username}");
- JDBC_TEMPLATE.addFilter("password","${hibernate.connection.password}");
- JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}");
- JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}");
-
- PROJECT_TEMPLATE = new FilterSet();
- PROJECT_TEMPLATE.addFilter("projectName","${project.name}");
- PROJECT_TEMPLATE.addFilter("jbossHome","${jboss.home}");
- PROJECT_TEMPLATE.addFilter("hbm2ddl","${hibernate.hbm2ddl.auto}");
- PROJECT_TEMPLATE.addFilter("driverJar","${driver.file}");
- PROJECT_TEMPLATE.addFilter("jndiPattern","${project.name}/#{ejbName}/local");
- PROJECT_TEMPLATE.addFilter("embeddedEjb","false");
-
- FILTERS_TEMPLATE = new FilterSet();
- FILTERS_TEMPLATE.addFilter("interfaceName","${interface.name}");
- FILTERS_TEMPLATE.addFilter("beanName","${bean.name}");
- FILTERS_TEMPLATE.addFilter("entityName","${entity.name}");
- FILTERS_TEMPLATE.addFilter("methodName","${method.name}");
- FILTERS_TEMPLATE.addFilter("componentName","${component.name}");
- FILTERS_TEMPLATE.addFilter("pageName","${page.name}");
- FILTERS_TEMPLATE.addFilter("masterPageName","${masterPage.name}");
- FILTERS_TEMPLATE.addFilter("actionPackage","${action.package}");
- FILTERS_TEMPLATE.addFilter("modelPackage","${model.package}");
- FILTERS_TEMPLATE.addFilter("testPackage","${test.package}");
- FILTERS_TEMPLATE.addFilter("listName","${component.name}List");
- 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) {
- return aplayProperties(JDBC_TEMPLATE, values);
- }
- public static FilterSet createProjectFilterSet(IDataModel values){
- return aplayProperties(PROJECT_TEMPLATE, values);
- }
-
- public static FilterSet createFiltersFilterSet(IDataModel values) {
- return aplayProperties(FILTERS_TEMPLATE, values);
- }
-
- public static FilterSet createHibernateDialectFilterSet(IDataModel values) {
- return aplayProperties(HIBERNATE_DIALECT_TEMPLATE, values);
- }
-
- private static FilterSet aplayProperties(FilterSet template,IDataModel values) {
- FilterSet result = new FilterSet();
- for (Object filter : template.getFilterHash().keySet()) {
- String value = template.getFilterHash().get(filter).toString();
- for (Object property : values.getAllProperties()) {
- if(value.contains("${"+property.toString()+"}")) {
- value =
value.replace("${"+property.toString()+"}",values.getProperty(property.toString()).toString());
- }
- }
- result.addFilter(filter.toString(), value);
- }
- return result;
- }
- }
-
private void writeXModel(IProject project, IDataModel model) {
String projectName = project.getName();
String webContent = "WebContent";
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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 org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamFacetPostInstallDelegate implements
+ IDelegate {
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ IEclipsePreferences prefs = SeamCorePlugin.getSeamFacetPreferences(project);
+ IDataModel model = (IDataModel)config;
+ for (Object propertyName : model.getAllProperties()) {
+ Object value = model.getProperty(propertyName.toString());
+ prefs.put(propertyName.toString(), value==null?"":value.toString());
+ }
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+}
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-07-17 08:29:11
UTC (rev 2454)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-17 08:33:03
UTC (rev 2455)
@@ -38,7 +38,9 @@
org.eclipse.emf.ecore,
org.eclipse.jst.j2ee.ui,
org.eclipse.jst.j2ee.web,
- org.eclipse.wst.xml.ui
+ org.eclipse.wst.xml.ui,
+ org.apache.ant,
+ org.jboss.ide.eclipse.jdt.core
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.seam.ui,
org.jboss.tools.seam.ui.views,
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-17 08:29:11 UTC (rev
2454)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-17 08:33:03 UTC (rev
2455)
@@ -77,7 +77,7 @@
</extension>
<extension
point="org.eclipse.wst.common.project.facet.ui.wizardPages">
- <wizard-pages action="jst.seam.2.0.install">
+ <wizard-pages action="jst.seam.1.2.install">
<page
class="org.jboss.tools.seam.ui.internal.project.facet.SeamInstallWizardPage"/>
</wizard-pages>
</extension>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -69,5 +69,4 @@
public static IPluginLog getPluginLog() {
return getDefault();
}
-
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/DataModelValidatorDelegate.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -29,6 +29,7 @@
*/
protected IDataModel model = null;
+
/**
*
*/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/IValidator.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -12,6 +12,8 @@
import java.util.Map;
+import org.eclipse.core.runtime.IAdaptable;
+
/**
*
* @author eskimo
@@ -19,6 +21,8 @@
*/
public interface IValidator {
+ public static final String DEFAULT_ERROR = "default.error";
+
/**
*
* @param value
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-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -11,11 +11,28 @@
package org.jboss.tools.seam.ui.internal.project.facet;
import java.io.File;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaConventions;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.corext.util.Messages;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.wizard.IParameter;
/**
*
@@ -24,6 +41,8 @@
*/
public class ValidatorFactory {
+
+
/**
*
*/
@@ -69,7 +88,7 @@
*/
public static Map<String,String> createErrormessage(String text) {
Map<String,String> map = createErrorMap();
- map.put("", text);
+ map.put(IValidator.DEFAULT_ERROR, text);
return map;
}
@@ -145,7 +164,15 @@
*/
public static IValidator CLASS_QNAME_VALIDATOR = new IValidator() {
public Map<String, String> validate(Object value, Object context) {
-
+ String classDecl = "class " + value.toString() + " {}";
+ ASTParser parser= ASTParser.newParser(AST.JLS3);
+ parser.setSource(classDecl.toCharArray());
+ parser.setProject((IJavaProject)context);
+ CompilationUnit compilationUnit= (CompilationUnit) parser.createAST(null);
+ IProblem[] problems= compilationUnit.getProblems();
+ if (problems.length > 0) {
+ return createErrormessage(Messages.format("Component name is not invalid.",
problems[0].getMessage()));
+ }
return ValidatorFactory.NO_ERRORS;
}
};
@@ -158,5 +185,126 @@
return ValidatorFactory.NO_ERRORS;
};
};
+ /**
+ *
+ * @author eskimo
+ *
+ */
+ public static IValidator SEAM_COMPONENT_NAME_VALIDATOR = new IValidator() {
+
+ public Map<String, String> validate(Object value, Object context) {
+ String targetName = null;
+ IProject project = null;
+ if(context instanceof Object[]) {
+ Object[] contextArray = ((Object[])context);
+ targetName = contextArray[0].toString();
+ project = (IProject)contextArray[1];
+ }
+
+ String classDecl = "class " + value + " {}";
+ ASTParser parser= ASTParser.newParser(AST.JLS3);
+ parser.setSource(classDecl.toCharArray());
+ parser.setProject(JavaCore.create(project));
+ CompilationUnit compilationUnit= (CompilationUnit) parser.createAST(null);
+ IProblem[] problems= compilationUnit.getProblems();
+
+ if (problems.length > 0) {
+ return createErrormessage(targetName + " name is not valid.");
+ }
+
+ return NO_ERRORS;
+ }
+ };
+ /**
+ *
+ * @author eskimo
+ *
+ */
+ public static IValidator SEAM_JAVA_INTEFACE_NAME_CONVENTION_VALIDATOR = new IValidator()
{
+
+ public Map<String, String> validate(Object value, Object context) {
+ String targetName = null;
+ IProject project = null;
+ if(context instanceof Object[]) {
+ Object[] contextArray = ((Object[])context);
+ targetName = contextArray[0].toString();
+ project = (IProject)contextArray[1];
+ }
+ IJavaProject jProject = JavaCore.create(project);
+
+ String sourceLevel= jProject.getOption(JavaCore.COMPILER_SOURCE, true);
+ String compliance= jProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ IStatus status = JavaConventions.validateJavaTypeName(value.toString(), sourceLevel,
compliance);
+ if(status.getSeverity() == IStatus.WARNING) {
+ return createErrormessage("Local Interface name is not valid.\n" +
status.getMessage());
+ }
+ return NO_ERRORS;
+ }
+ };
+
+ public static IValidator SEAM_METHOD_NAME_VALIDATOR = new IValidator() {
+
+ public Map<String, String> validate(Object value, Object context) {
+ String targetName = null;
+ IProject project = null;
+
+ if(context instanceof Object[]) {
+ Object[] contextArray = ((Object[])context);
+ targetName = contextArray[0].toString();
+ project = (IProject)contextArray[1];
+ }
+
+ String classDecl = "class ClassName {public void " + value.toString() +
"() {}}";
+ ASTParser parser= ASTParser.newParser(AST.JLS3);
+ parser.setSource(classDecl.toCharArray());
+ parser.setProject(JavaCore.create(project));
+ CompilationUnit compilationUnit= (CompilationUnit) parser.createAST(null);
+ IProblem[] problems= compilationUnit.getProblems();
+
+ if (problems.length > 0) {
+ return createErrormessage(targetName + " name is not valid.");
+ }
+
+ return NO_ERRORS;
+ }
+ };
+
+ public static IValidator FILE_NAME_VALIDATOR = new IValidator() {
+
+ public Map<String, String> validate(Object value, Object context) {
+ String targetName = null;
+ IProject project = null;
+
+ if(context instanceof Object[]) {
+ Object[] contextArray = ((Object[])context);
+ targetName = contextArray[0].toString();
+ project = (IProject)contextArray[1];
+ }
+ if("".equals(value) ||
!project.getLocation().isValidSegment(value.toString()))
+ return createErrormessage(targetName + " name is not valid.");
+
+ return NO_ERRORS;
+ }
+ };
+
+ public static IValidator SEAM_PROJECT_NAME_VALIDATOR = new IValidator() {
+ public Map<String, String> validate(Object value, Object context) {
+
+ IResource project =
ResourcesPlugin.getWorkspace().getRoot().findMember(value.toString());
+
+ if(project==null || !(project instanceof IProject) || !project.exists()) {
+ return createErrormessage("Project '" + value + "' does'n
exist.");
+ } else {
+ try {
+ if(!((IProject)project).hasNature(ISeamProject.NATURE_ID)) {
+ return createErrormessage("Project '" + project.getName()+
"' has no Seam nature.");
+ }
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ return NO_ERRORS;
+ }
+ };
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -182,8 +182,9 @@
* @param newValue
*/
public void setValue(Object newValue) {
- pcs.firePropertyChange(nameText,value,newValue);
+ Object oldValue = value;
value = newValue;
+ pcs.firePropertyChange(nameText,oldValue,newValue);
}
/**
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/TextField.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/TextField.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/TextField.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -31,7 +31,7 @@
}
public void modifyText(ModifyEvent e) {
- firePropertyChange("",((Text)e.widget).getText());
+ firePropertyChange(new Object(),((Text)e.widget).getText());
}
public Text getTextControl() {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -18,11 +18,11 @@
public interface IParameter {
public static String SEAM_PROJECT_NAME = "seam.project.name";
- public static String SEAM_COMPONENT_NAME = "seam.component.name";
- public static String SEAM_LOCAL_INTERFACE_NAME =
"seam.local.interface.name.";
- public static String SEAM_BEAN_NAME = "seam.bean.name";
- public static String SEAM_METHOD_NAME = "seam.method.name";
- public static String SEAM_PAGE_NAME = "seam.page.name";
- public static String SEAM_MASTER_PAGE_NAME = "seam.master.page.name";
- public static String SEAM_ENTITY_CLASS_NAME = "seam.entity.class.name";
+ public static String SEAM_COMPONENT_NAME = "component.name";
+ public static String SEAM_LOCAL_INTERFACE_NAME = "interface.name";
+ public static String SEAM_BEAN_NAME = "bean.name";
+ public static String SEAM_METHOD_NAME = "method.name";
+ public static String SEAM_PAGE_NAME = "page.name";
+ public static String SEAM_MASTER_PAGE_NAME = "masterPage.name";
+ public static String SEAM_ENTITY_CLASS_NAME = "entity.name";
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -10,18 +10,40 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
import java.util.Map;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
+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.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetFilterSetFactory;
+/**
+ *
+ * @author eskimo
+ *
+ */
public class SeamActionWizard extends SeamBaseWizard implements INewWizard {
+ /**
+ *
+ */
public SeamActionWizard() {
super(CREATE_SEAM_ACTION);
setWindowTitle("New Seam Action");
@@ -29,17 +51,27 @@
addPage(new SeamActionWizardPage1());
}
- // TODO move operations to core plugin
+ /**
+ *
+ * TODO move operations to core plugin
+ */
public static final IUndoableOperation CREATE_SEAM_ACTION = new
SeamBaseOperation("Action creating operation"){
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- Map params = (Map)info.getAdapter(Map.class);
-
- return Status.OK_STATUS;
+
+
+ public File getBeanFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"src/ActionJavaBean.java");
}
+ public File getTestClassFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"test/ActionTest.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/action.xhtml");
+ }
};
-
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -11,18 +11,39 @@
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetFilterSetFactory;
+import org.jboss.tools.seam.ui.widget.editor.INamedElement;
+import org.osgi.service.prefs.BackingStoreException;
/**
* @author eskimo
*
*/
-public class SeamBaseOperation extends AbstractOperation {
+public abstract class SeamBaseOperation extends AbstractOperation {
/**
* @param label
@@ -38,9 +59,81 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- throw new IllegalStateException("Execute method should be overiden");
+ Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
+ Map<String, Object> vars = new HashMap<String, Object>();
+ IEclipsePreferences seamFacetPrefs = SeamCorePlugin.getSeamFacetPreferences(
+ ResourcesPlugin.getWorkspace().getRoot().getProject(params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString()));
+ try {
+
+ for (String key : seamFacetPrefs.keys()) {
+ vars.put(key, seamFacetPrefs.get(key, ""));
+ }
+
+ for (Object valueHolder : params.values()) {
+ INamedElement elem = (INamedElement)valueHolder;
+ vars.put(elem.getName(),elem.getValue().toString());
+ }
+ vars.put(ISeamFacetDataModelProperties.SEAM_PROJECT_INSTANCE,
+ ResourcesPlugin.getWorkspace().getRoot().getProject(
+ vars.get(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME).toString()));
+
+ return execute(monitor, vars);
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return Status.OK_STATUS;
}
+ /**
+ *
+ * @param monitor
+ * @param params
+ * @return
+ * @throws ExecutionException
+ */
+ public IStatus execute(IProgressMonitor monitor, Map<String,Object> vars)
+ throws ExecutionException {
+
+ // Target Project
+ IProject targetProject =
(IProject)vars.get(ISeamFacetDataModelProperties.SEAM_PROJECT_INSTANCE);
+
+ IVirtualComponent com = ComponentCore.createComponent(targetProject);
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
+ IContainer webRootContainer = webRootFolder.getUnderlyingFolder();
+
+ FilterSetCollection filters = new
FilterSetCollection(SeamFacetFilterSetFactory.createFiltersFilterSet(vars));
+
+ // Input data
+// String beanName = vars.get(IParameter.SEAM_BEAN_NAME).toString();
+ String actionFolder =
vars.get(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString();
+ String interfaceName = vars.get(IParameter.SEAM_LOCAL_INTERFACE_NAME).toString();
+ String testFolder =
vars.get(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME).toString();
+ String pageName = vars.get(IParameter.SEAM_PAGE_NAME).toString();
+
+ File seamTargetInterfaceFile = new File(targetProject.getLocation().toFile().toString()
+ + "/src/" + actionFolder.replace('.','/') + "/" +
interfaceName + ".java");
+ AntCopyUtils.copyFileToFile(getBeanFile(vars),seamTargetInterfaceFile,filters,true);
+
+ File seamTargetActionTestFile = new
File(targetProject.getLocation().toFile().toString()
+ + "/src/" + testFolder.replace('.','/') + "/" +
interfaceName + "Test.java");
+ AntCopyUtils.copyFileToFile(getTestClassFile(vars),seamTargetActionTestFile,filters,true);
+
+ File seamTargetTestinFile = new File(targetProject.getLocation().toFile().toString()
+ + "/src/" + testFolder.replace('.','/') + "/" +
interfaceName + "Test.xml");
+ AntCopyUtils.copyFileToFile(getTestngXmlFile(vars),seamTargetTestinFile,filters,true);
+
+ File seamTargetActionPageFile = new
File(webRootContainer.getLocation().toFile().toString()
+ + "/" + pageName + ".xhtml");
+ AntCopyUtils.copyFileToFile(getPageXhtml(vars),seamTargetActionPageFile,filters,true);
+
+ try {
+ targetProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return Status.OK_STATUS;
+ }
+
/* (non-Javadoc)
* @see
org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.core.runtime.IAdaptable)
*/
@@ -68,4 +161,16 @@
public boolean canUndo() {
return false;
}
+
+ public File getSeamFolder(Map<String, Object> vars) {
+ return new
File(vars.get(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString(),"seam-gen");
+ }
+
+ public abstract File getBeanFile(Map<String, Object> vars);
+
+ public abstract File getTestClassFile(Map<String, Object> vars);
+
+ public abstract File getTestngXmlFile(Map<String, Object> vars);
+
+ public abstract File getPageXhtml(Map<String, Object> vars);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -11,24 +11,37 @@
package org.jboss.tools.seam.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
/**
* @author eskimo
*
*/
-public class SeamBaseWizardPage extends WizardPage implements IAdaptable {
+public class SeamBaseWizardPage extends WizardPage implements IAdaptable,
PropertyChangeListener {
/**
*
@@ -63,6 +76,16 @@
*/
public void createControl(Composite parent) {
setControl(new GridLayoutComposite(parent));
+
+ if
(!"".equals(editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue())){
+ Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue(), null);
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ }
+ }
+ setPageComplete(false);
}
/* (non-Javadoc)
@@ -82,7 +105,9 @@
public void addEditor(IFieldEditor editor) {
editorRegistry.put(editor.getName(), editor);
editorOrder.add(editor);
+ editor.addPropertyChangeListener(this);
}
+
/**
*
* @param id
@@ -90,13 +115,21 @@
*/
public void addEditors(IFieldEditor[] editors) {
for (IFieldEditor fieldEditor : editors) {
- editorRegistry.put(fieldEditor.getName(), fieldEditor);
- editorOrder.add(fieldEditor);
+ addEditor(fieldEditor);
}
}
/**
*
+ * @param name
+ * @return
+ */
+ public IFieldEditor getEditor(String name) {
+ return editorRegistry.get(name);
+ }
+
+ /**
+ *
* @author eskimo
*
*/
@@ -122,7 +155,76 @@
public GridLayoutComposite(Composite parent) {
this(parent, SWT.NONE);
-
}
}
+
+ /* (non-Javadoc)
+ * @see
java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ // TODO - finish validation
+
+ Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue(), null);
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember(
+ editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
+
+
+ errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_COMPONENT_NAME).getValue(), new
Object[]{"Seam component",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_LOCAL_INTERFACE_NAME).getValue(), new
Object[]{"Local interface",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ errors = ValidatorFactory.SEAM_METHOD_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_METHOD_NAME).getValue(), new
Object[]{"Method",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ errors = ValidatorFactory.FILE_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_PAGE_NAME).getValue(), (Object)new
Object[]{"Page",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ errors = ValidatorFactory.SEAM_JAVA_INTEFACE_NAME_CONVENTION_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_LOCAL_INTERFACE_NAME).getValue(), new
Object[]{"Local interface",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(null);
+ setMessage(errors.get(IValidator.DEFAULT_ERROR).toString(),IMessageProvider.WARNING);
+ setPageComplete(true);
+ return;
+ }
+
+ setErrorMessage(null);
+ setMessage(null);
+ setPageComplete(true);
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
@@ -30,14 +31,22 @@
public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new
SeamBaseOperation("Action creating operation"){
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- Map params = (Map)info.getAdapter(Map.class);
-
- return Status.OK_STATUS;
+ public File getBeanFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"src/ActionJavaBean.java");
}
+ public File getTestClassFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"test/ActionTest.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/action.xhtml");
+ }
+
};
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
@@ -38,15 +39,23 @@
// TODO move operations to core plugin
public static final IUndoableOperation CREATE_SEAM_ENTITY = new
SeamBaseOperation("Action creating operation"){
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- Map params = (Map)info.getAdapter(Map.class);
-
- return Status.OK_STATUS;
+
+ public File getBeanFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"src/ActionJavaBean.java");
}
+ public File getTestClassFile(Map<String, Object> vars) {
+ return new File(getSeamFolder(vars),"test/ActionTest.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/action.xhtml");
+ }
+
};
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -30,7 +30,7 @@
*
*/
protected void createEditors() {
- addEditor(SeamWizardFactory.createSeamProjctSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()));
+ addEditor(SeamWizardFactory.createSeamProjectSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()));
addEditor(SeamWizardFactory.createSeamEntityClasNameFieldEditor());
addEditor(SeamWizardFactory.createSeamMasterPageNameFieldEditor());
addEditor(SeamWizardFactory.createSeamPageNameFieldEditor());
Modified:
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-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFofrmWizard.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
@@ -27,22 +28,32 @@
*/
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 SeamBaseOperation("Action
creating operation"){
+ private static IUndoableOperation CREATE_SEAM_FORM = new SeamBaseOperation("Form
creating operation"){
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- Map params = (Map)info.getAdapter(Map.class);
-
- return Status.OK_STATUS;
+
+ 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");
+ }
};
-
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -11,7 +11,11 @@
package org.jboss.tools.seam.ui.wizard;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -20,6 +24,8 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ListDialog;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.SeamProject;
/**
* @author eskimo
@@ -38,7 +44,17 @@
setInput(new Object());
setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
- return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ ArrayList<IProject> seamProjects = new ArrayList<IProject>();
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ try {
+ if(project.hasNature(SeamProject.NATURE_ID)) {
+ seamProjects.add(project);
+ }
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ return seamProjects.toArray();
}
public void dispose() {
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -58,7 +58,7 @@
@Override
public void createPageControls(Composite container) {
super.createPageControls(container);
- getModel().setSelectedPreset("preset.jst.seam.v2_0");
+ getModel().setSelectedPreset("preset.jst.seam.v1_2");
Control control = findControlByClass((Composite)getShell(),
PresetSelectionPanel.class);
control.setVisible(false);
control = findGroupByText((Composite)getShell(), "EAR Membership");
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-17
08:29:11 UTC (rev 2454)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-17
08:33:03 UTC (rev 2455)
@@ -20,7 +20,7 @@
*
*/
public class SeamWizardFactory {
- public static IFieldEditor createSeamProjctSelectionFieldEditor(
+ public static IFieldEditor createSeamProjectSelectionFieldEditor(
String defaultSelection) {
return SwtFieldEditorFactory.INSTANCE.createButtonFieldEditor(
IParameter.SEAM_PROJECT_NAME, "Seam Project:", defaultSelection,
@@ -72,9 +72,10 @@
public static final IFieldEditor[] createDefaultWizardEditors(String defaultSelection)
{
return new IFieldEditor[]{
- SeamWizardFactory.createSeamProjctSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()),
+ SeamWizardFactory.createSeamProjectSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()),
+ SeamWizardFactory.createSeamComponentNameFieldEditor(),
SeamWizardFactory.createSeamLocalInterfaceNameFieldEditor(),
- SeamWizardFactory.createSeamBeanNameFieldEditor(),
+// SeamWizardFactory.createSeamBeanNameFieldEditor(),
SeamWizardFactory.createSeamMethodNameFieldEditor(),
SeamWizardFactory.createSeamPageNameFieldEditor()
};
@@ -83,6 +84,15 @@
/**
* @return
*/
+ public static IFieldEditor createSeamComponentNameFieldEditor() {
+ // TODO Auto-generated method stub
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_COMPONENT_NAME, "Seam component name:", "");
+ }
+
+ /**
+ * @return
+ */
public static IFieldEditor createSeamEntityClasNameFieldEditor() {
return SwtFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_ENTITY_CLASS_NAME, "Seam entity class name:",
"");