Denis,
It's great we now don't fixate the facet for our jboss runtime, but why do
we have to do those additional validations ?
Isn't these done automatically by the facet framework ? (e.g. I would
expect the validations agaisnt jst.jsf, jst.web and versions are still
performed as normally by the facet framework)
Or is it simply for pre-validating the facets needed for the possible
ejb/ear projects?
/max
------- Forwarded message -------
From: jbosstools-commits(a)lists.jboss.org
To: jbosstools-commits(a)lists.jboss.org
Cc:
Subject: [jbosstools-commits] JBoss Tools SVN: r4997 - in
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui:
internal/project/facet and 1 other directory.
Date: Wed, 21 Nov 2007 03:40:40 +0100
Author: dgolovin
Date: 2007-11-20 21:40:40 -0500 (Tue, 20 Nov 2007)
New Revision: 4997
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
Log:
http://jira.jboss.org/jira/browse/JBIDE-1320
lock to JBoss AS runtime is removed from plugin.xml,
werification for selected Deployment type is added. If selected runtime
have not supported EJB 3.0 and EAR 5.0 modules errori showed on seam
facet wizard page title.
It was verified on JBoss AS and Tomcat servers
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-11-21
01:01:12 UTC (rev 4996)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-11-21
02:40:40 UTC (rev 4997)
@@ -115,6 +115,8 @@
public static String SEAM_INSTALL_WIZARD_PAGE_ADD;
+ public static String
SEAM_INSTALL_WIZARD_PAGE_CANNOT_USE_SELECTED_DEPLOYMENT6;
+
public static String SEAM_INSTALL_WIZARD_PAGE_CODE_GENERATION;
public static String
SEAM_INSTALL_WIZARD_PAGE_CONFIGURE_SEAM_FACET_SETTINGS;
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-11-21
01:01:12 UTC (rev 4996)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-11-21
02:40:40 UTC (rev 4997)
@@ -33,6 +33,7 @@
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import
org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -41,10 +42,16 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.internal.dialogs.PropertyDialog;
import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import
org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
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.frameworks.internal.operations.ProjectCreationDataModelProviderNew;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
import
org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
@@ -382,6 +389,11 @@
IFacetDataModelProperties.FACET_PROJECT_NAME,
new ProjectNamesDuplicationValidator(
IFacetDataModelProperties.FACET_PROJECT_NAME));
+ validatorDelegate.addValidatorForProperty(
+ ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
+ new DeploymentTypeValidator(
+ ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
+ ((NewProjectDataModelFacetWizard)getWizard()).getDataModel()));
}
jBossHibernateDbTypeEditor
@@ -541,7 +553,7 @@
if (visible) {
ITaggedFieldEditor runtimesField =
(ITaggedFieldEditor)((CompositeEditor)jBossSeamHomeEditor).getEditors().get(1);
Object oldValue = runtimesField.getValue();
- Object newValue = "";
+ Object newValue = ""; //$NON-NLS-1$
List<String> runtimes =
getRuntimeNames(model.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString());
if(oldValue==null || !runtimes.contains(oldValue)) {
Object defaultRnt = getSeamRuntimeDefaultValue();
@@ -612,12 +624,10 @@
*/
public Map<String, String> validate(Object value, Object context) {
final String projectName = (String)value;
-
- IDataModel model = (IDataModel)context;
final String deployAs = model.getStringProperty(
ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS);
- final String testProjectName = projectName + "-test";
+ final String testProjectName = projectName + "-test"; //$NON-NLS-1$
IStatus status =
ProjectCreationDataModelProviderNew.validateName(testProjectName);
if (!status.isOK())
return ValidatorFactory.createErrormessage(propertyName,
@@ -626,7 +636,7 @@
SeamUIMessages.VALIDATOR_FACTORY_PROJECT_ALREADY_EXISTS);
if (ISeamFacetDataModelProperties.DEPLOY_AS_EAR.equals(deployAs)) {
- final String earProjectName = projectName + "-ear";
+ final String earProjectName = projectName + "-ear"; //$NON-NLS-1$
status =
ProjectCreationDataModelProviderNew.validateName(earProjectName);
if (!status.isOK())
return ValidatorFactory.createErrormessage(propertyName,
@@ -634,7 +644,7 @@
earProjectName +
SeamUIMessages.VALIDATOR_FACTORY_PROJECT_ALREADY_EXISTS);
- final String ejbProjectName = projectName + "-ejb";
+ final String ejbProjectName = projectName + "-ejb"; //$NON-NLS-1$
status =
ProjectCreationDataModelProviderNew.validateName(ejbProjectName);
if (!status.isOK())
return ValidatorFactory.createErrormessage(propertyName,
@@ -646,6 +656,46 @@
}
}
+ static class DeploymentTypeValidator implements IValidator {
+
+ String propertyName;
+
+ IDataModel model;
+
+ static final IProjectFacet EJB_FACET =
ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EJB_MODULE);
+
+ static final IProjectFacetVersion EJB_30 = EJB_FACET.getVersion("3.0");
//$NON-NLS-1$
+
+ static final IProjectFacet EAR_FACET =
ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE);
+
+ static final IProjectFacetVersion EAR_50 = EAR_FACET.getVersion("5.0");
//$NON-NLS-1$
+
+ /**
+ */
+ public DeploymentTypeValidator (String propertyName, IDataModel model) {
+ this.propertyName = propertyName;
+ this.model = model;
+ }
+
+ /**
+ * @see IValidator#validate(Object, Object)
+ */
+ public Map<String, String> validate(Object value, Object context) {
+
+ final String deploymentType = value.toString();
+ if(!ISeamFacetDataModelProperties.DEPLOY_AS_WAR.equals(deploymentType))
{
+ String runtimeName =
model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME).toString();
+ IRuntime rt = RuntimeManager.getRuntime(runtimeName);
+ if(!rt.supports(EJB_30) || !rt.supports(EAR_50)) {
+ return ValidatorFactory.createErrormessage(
+ propertyName,
+ NLS.bind(SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_CANNOT_USE_SELECTED_DEPLOYMENT6
, new String[]{deploymentType.toUpperCase(),runtimeName}));
+ }
+ }
+ return ValidatorFactory.NO_ERRORS;
+ }
+ }
+
public class NewSeamRuntimeAction extends
ButtonFieldEditor.ButtonPressedAction {
/**
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-11-21
01:01:12 UTC (rev 4996)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-11-21
02:40:40 UTC (rev 4997)
@@ -8,6 +8,7 @@
GENERATE_SEAM_ENTITIES_WIZARD_REVERSE_ENGINEER_LABEL = Reverse engineer
from database
GENERATE_SEAM_ENTITIES_WIZARD_EXISTING_ENTITIES_LABEL = Use existing
entities
SEAM_INSTALL_WIZARD_PAGE_CONFIGURE_SEAM_FACET_SETTINGS=Configure Seam
Facet Settings
+SEAM_INSTALL_WIZARD_PAGE_CANNOT_USE_SELECTED_DEPLOYMENT6=''{0}''
deployment cannot be used, because selected Server Runtime ''{1}''
doesn't
support EJB 3.0 and EAR 5.0 modules
SEAM_PROJECT_WIZARD_PAGE1_FILE_NAME_MUST_BE_SPECIFIED=File name must be
specified
SEAM_PROJECT_SELECTION_DIALOG_SELECT_SEAM_WEB_PROJECT=Select Seam Web
Project
SEAM_PROJECT_WIZARD_CREATE_STANDALONE_SEAM_WEB_PROJECT=Create standalone
Seam Web Project
_______________________________________________
jbosstools-commits mailing list
jbosstools-commits(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosstools-commits
--
--
Max Rydahl Andersen
callto://max.rydahl.andersen
Hibernate
max(a)hibernate.org
http://hibernate.org
JBoss a division of Red Hat
max.andersen(a)jboss.com