Author: akazakov
Date: 2008-10-27 09:29:53 -0400 (Mon, 27 Oct 2008)
New Revision: 11203
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.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/SeamEntityWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardCustomizationPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3004,
https://jira.jboss.org/jira/browse/JBIDE-3003
I've fixed error messages and I've added seam runtime validation in seam settings
page as we do it in seam wizards.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-10-27
13:15:35 UTC (rev 11202)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-10-27
13:29:53 UTC (rev 11203)
@@ -62,6 +62,7 @@
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
+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;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
@@ -512,6 +513,19 @@
setValid(false);
return;
}
+ Map<String, IStatus> errors =
ValidatorFactory.SEAM_RUNTIME_VALIDATOR.validate(value, null);
+ if(errors.size()>0) {
+ IStatus status = errors.get(IValidator.DEFAULT_ERROR);
+ if(IStatus.ERROR == status.getSeverity()) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
+ setValid(false);
+ return;
+ } else {
+ setMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
+ warning = true;
+ setValid(true);
+ }
+ }
}
boolean deployAsEar =
ISeamFacetDataModelProperties.DEPLOY_AS_EAR.equals(getValue(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2008-10-27
13:15:35 UTC (rev 11202)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2008-10-27
13:29:53 UTC (rev 11203)
@@ -26,6 +26,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IMessageProvider;
@@ -636,12 +637,12 @@
}
}
- Map errors = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR
+ Map<String, IStatus> errors = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR
.validate(homeDir.getValueAsString(), seamVersion);
if (errors != ValidatorFactory.NO_ERRORS) {
setErrorMessage(errors.get(
ISeamFacetDataModelProperties.JBOSS_SEAM_HOME)
- .toString());
+ .getMessage());
setPageComplete(false);
return;
}
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 2008-10-27
13:15:35 UTC (rev 11202)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2008-10-27
13:29:53 UTC (rev 11203)
@@ -22,6 +22,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -92,11 +93,11 @@
setControl(new GridLayoutComposite(parent));
if (!"".equals(editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue())){
//$NON-NLS-1$
- Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ Map<String, IStatus> errors =
ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
getEditor(IParameter.SEAM_PROJECT_NAME).getValue(), null);
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
} else if(isWar()) {
getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
@@ -221,11 +222,11 @@
LabelFieldEditor label =
(LabelFieldEditor)((CompositeEditor)getEditor(IParameter.SEAM_LOCAL_INTERFACE_NAME)).getEditors().get(0);
label.getLabelControl().setText(isWar?SeamUIMessages.SEAM_BASE_WIZARD_PAGE_POJO_CLASS_NAME:
SeamUIMessages.SEAM_BASE_WIZARD_PAGE_LOCAL_CLASS_NAME);
- Map errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
+ Map<String, IStatus> errors =
ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
editorRegistry.get(IParameter.SEAM_COMPONENT_NAME).getValue(), null);
if(errors.size()>0) {
- setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).toString(),SeamUIMessages.SEAM_BASE_WIZARD_PAGE_SEAM_COMPONENTS));
+ setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).getMessage(),SeamUIMessages.SEAM_BASE_WIZARD_PAGE_SEAM_COMPONENTS));
setPageComplete(false);
return;
}
@@ -234,7 +235,7 @@
editorRegistry.get(IParameter.SEAM_LOCAL_INTERFACE_NAME).getValue(), null);
if(errors.size()>0) {
- setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).toString(),SeamUIMessages.SEAM_BASE_WIZARD_PAGE_LOCAL_INTERFACE));
+ setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).getMessage(),SeamUIMessages.SEAM_BASE_WIZARD_PAGE_LOCAL_INTERFACE));
setPageComplete(false);
return;
}
@@ -244,7 +245,7 @@
editorRegistry.get(IParameter.SEAM_BEAN_NAME).getValue(), null);
if(errors.size()>0) {
- setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).toString(),"Bean"));
//$NON-NLS-1$
+ setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).getMessage(),"Bean"));
//$NON-NLS-1$
setPageComplete(false);
return;
}
@@ -254,7 +255,7 @@
if(editor!=null) {
errors = ValidatorFactory.PACKAGE_NAME_VALIDATOR.validate(editor.getValue(), null);
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString()); //$NON-NLS-1$
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage()); //$NON-NLS-1$
setPageComplete(false);
return;
}
@@ -264,7 +265,7 @@
editorRegistry.get(IParameter.SEAM_METHOD_NAME).getValue(), new
Object[]{"Method",project}); //$NON-NLS-1$
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
setPageComplete(false);
return;
}
@@ -273,7 +274,7 @@
editorRegistry.get(IParameter.SEAM_PAGE_NAME).getValue(), new
Object[]{"Page",project}); //$NON-NLS-1$
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
setPageComplete(false);
return;
}
@@ -283,7 +284,7 @@
if(errors.size()>0) {
setErrorMessage(null);
- setMessage(errors.get(IValidator.DEFAULT_ERROR).toString(),IMessageProvider.WARNING);
+ setMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage(),IMessageProvider.WARNING);
setPageComplete(true);
return;
}
@@ -308,11 +309,11 @@
* @param project
*/
protected boolean isValidRuntimeConfigured(IProject project) {
- Map errors;
+ Map<String, IStatus> errors;
String seamRt =
SeamCorePlugin.getSeamPreferences(project).get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,"");
//$NON-NLS-1$
errors = ValidatorFactory.SEAM_RUNTIME_VALIDATOR.validate(seamRt, null);
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
setPageComplete(false);
return false;
}
@@ -320,15 +321,16 @@
}
protected boolean isValidProjectSelected() {
- Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ Map<String, IStatus> errors =
ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue(), null);
if(errors.size()>0 || !isProjectSettingsOk()) {
- Object errorMessage = errors.get(IValidator.DEFAULT_ERROR);
- if(errorMessage==null) {
- errorMessage = SeamUIMessages.VALIDATOR_INVALID_SETTINGS;
+ IStatus errorStatus = errors.get(IValidator.DEFAULT_ERROR);
+ String errorMessage = SeamUIMessages.VALIDATOR_INVALID_SETTINGS;
+ if(errorStatus!=null) {
+ errorMessage = errorStatus.getMessage();
}
- setErrorMessage(errorMessage.toString());
+ setErrorMessage(errorMessage);
setPageComplete(false);
IFieldEditor beanEditor = getEditor(IParameter.SEAM_BEAN_NAME);
if(beanEditor!=null) {
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 2008-10-27
13:15:35 UTC (rev 11202)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2008-10-27
13:29:53 UTC (rev 11203)
@@ -15,6 +15,7 @@
import java.util.Map;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
@@ -132,11 +133,11 @@
if(!isValidRuntimeConfigured(project)) return;
- Map errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
+ Map<String, IStatus> errors =
ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
editorRegistry.get(IParameter.SEAM_ENTITY_CLASS_NAME).getValue(), null);
if(errors.size()>0) {
- setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).toString(),SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_ENTITY_CLASS_NAME));
+ setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).getMessage(),SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_ENTITY_CLASS_NAME));
setPageComplete(false);
return;
}
@@ -145,7 +146,7 @@
if(editor!=null) {
errors = ValidatorFactory.PACKAGE_NAME_VALIDATOR.validate(editor.getValue(), null);
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString()); //$NON-NLS-1$
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage()); //$NON-NLS-1$
setPageComplete(false);
return;
}
@@ -155,7 +156,7 @@
editorRegistry.get(IParameter.SEAM_MASTER_PAGE_NAME).getValue(), new
Object[]{SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_ENTITY_MASTER_PAGE,project,project});
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
setPageComplete(false);
return;
}
@@ -164,7 +165,7 @@
editorRegistry.get(IParameter.SEAM_PAGE_NAME).getValue(), new
Object[]{SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_PAGE,project});
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
setPageComplete(false);
return;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java 2008-10-27
13:15:35 UTC (rev 11202)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java 2008-10-27
13:29:53 UTC (rev 11203)
@@ -195,11 +195,11 @@
* @param project
*/
protected boolean isValidRuntimeConfigured(IProject project) {
- Map errors;
+ Map<String, IStatus> errors;
String seamRt =
SeamCorePlugin.getSeamPreferences(project).get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,"");
//$NON-NLS-1$
errors = ValidatorFactory.SEAM_RUNTIME_VALIDATOR.validate(seamRt, null);
if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).getMessage());
setPageComplete(false);
return false;
}
@@ -213,14 +213,15 @@
IStatus errorMessage = errors.get(IValidator.DEFAULT_ERROR);
if(errorMessage==null) {
setErrorMessage(SeamUIMessages.VALIDATOR_INVALID_SETTINGS);
- }
- if(errorMessage.getSeverity()==IStatus.ERROR) {
- setErrorMessage(errorMessage.getMessage());
setPageComplete(false);
} else {
- setMessage(errorMessage.getMessage());
+ if(errorMessage.getSeverity()==IStatus.ERROR) {
+ setErrorMessage(errorMessage.getMessage());
+ setPageComplete(false);
+ } else {
+ setMessage(errorMessage.getMessage());
+ }
}
-
return;
}
String config = (String)configEditor.getValue();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardCustomizationPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardCustomizationPage.java 2008-10-27
13:15:35 UTC (rev 11202)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardCustomizationPage.java 2008-10-27
13:29:53 UTC (rev 11203)
@@ -14,6 +14,7 @@
import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
@@ -57,7 +58,7 @@
setControl(new GridLayoutComposite(parent));
if (!"".equals(editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue())){
//$NON-NLS-1$
- Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ Map<String, IStatus> errors =
ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
getEditor(IParameter.SEAM_PROJECT_NAME).getValue(), null);
}