Author: dgolovin
Date: 2007-10-17 10:15:28 -0400 (Wed, 17 Oct 2007)
New Revision: 4293
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/messages.properties
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/SeamProjectWizard.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-985
validation for seam runtime added
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-10-17
14:15:24 UTC (rev 4292)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-10-17
14:15:28 UTC (rev 4293)
@@ -299,6 +299,8 @@
public static String TEXT_FIELD_EDITOR_PARENT_CONTROL_SHOULD_BE_COMPOSITE;
+ public static String VALIDATOR_FACTORY_CANNOT_FIND_SEAM_RUNTIME;
+
public static String VALIDATOR_FACTORY_COMPONENT_NAME_IS_NOT_VALID;
public static String VALIDATOR_FACTORY_CONNECTION_PROFILE;
@@ -337,10 +339,34 @@
public static String VALIDATOR_FACTORY_POINTS_TO_FILE;
+ public static String VALIDATOR_FACTORY_PRJ_NOT_SELECTED;
+
public static String VALIDATOR_FACTORY_PROJECT;
public static String VALIDATOR_FACTORY_SEAM_HOME_FOLDER_DOES_NOT_EXISTS;
+ public static String VALIDATOR_FACTORY_SEAM_RT_CANNOT_BE_FOUND;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_DOES_NOT_EXIST;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_IS_MISSING;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_NOT_CONFIGURED;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_RESOURCES_DIR_IS_MISSING;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_SOURCE_TEMPLATES_DIR_DOES_NOT_EXIST;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_SRC_DIR_IS_MISSING;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_DOES_NOT_EXIST;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_IS_MISSING;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_VIE_TEMPLATE_DIR_DOES_NOT_EXIST;
+
+ public static String VALIDATOR_FACTORY_SEAM_RT_VIEW_DIR_IS_MISSING;
+
public static String VALIDATOR_FACTORY_SEAM_RUNTIME_IS_NOT_SELECTED;
public static String VALIDATOR_FACTORY_SELECTED_PROJECT;
@@ -353,7 +379,7 @@
public static String VALIDATOR_FACTORY_PROJECT_ALREADY_EXISTS;
- public static String SEAM_TARGET_RUNTIME;
+ public static String SEAM_TARGET_SERVER;
static {
// load message values from bundle file
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-10-17
14:15:24 UTC (rev 4292)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-10-17
14:15:28 UTC (rev 4293)
@@ -119,6 +119,12 @@
VALIDATOR_FACTORY_PATH=Path '
VALIDATOR_FACTORY_POINTS_TO_FILE=' points to file
VALIDATOR_FACTORY_SEAM_HOME_FOLDER_DOES_NOT_EXISTS=Seam Home folder doesn't exist
+VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_DOES_NOT_EXIST=Seam Runtime ''{0}''
home directory doesn't exist for selected Seam Web Project
+VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_IS_MISSING=Seam Runtime ''{0}'' home
directory doesn't exist
+VALIDATOR_FACTORY_SEAM_RT_RESOURCES_DIR_IS_MISSING=Seam Runtime '{0)' resource
templates directory doesn't exist
+VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_DOES_NOT_EXIST=Seam Runtime
''{0}'' templates directory doesn't exist for selected Seam Web
Project
+VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_IS_MISSING=Seam Runtime ''{0}''
templates directory doesn't exist
+VALIDATOR_FACTORY_SEAM_RT_VIE_TEMPLATE_DIR_DOES_NOT_EXIST=Seam Runtime
''{0}'' view templates directory doesn't exist for selected Seam Web
Project
VALIDATOR_FACTORY_HOME_FOLDER_POINTS_TO=Home folder points to
VALIDATOR_FACTORY_LOCATION_THAT_DOES_NOT_LOOK_LIKE_SEAM_HOME_FOLDER=location that does
not look like seam home folder ('jboss-seam.jar' is missing)
VALIDATOR_FACTORY_JBOSS_AS_HOME_FOLDER_DOES_NOT_EXIST=JBoss AS Home folder doesn't
exist
@@ -129,17 +135,24 @@
VALIDATOR_FACTORY_LOCAL_INTERFACE_NAME_IS_NOT_VALID=Local Interface name is not valid.\n
VALIDATOR_FACTORY_NAME_IS_NOT_VALID2=\ name is not valid.
VALIDATOR_FACTORY_PROJECT=Project '
-VALIDATOR_FACTORY_DOES_NOT_EXIST=' does'n exist.
+VALIDATOR_FACTORY_DOES_NOT_EXIST=' doesn't exist.
VALIDATOR_FACTORY_SELECTED_PROJECT=Selected project '
+VALIDATOR_FACTORY_PRJ_NOT_SELECTED=Project is not selected
VALIDATOR_FACTORY_IS_NOT_A_SEAM_WEB_PROJECT=' is not a Seam Web Project
VALIDATOR_FACTORY_CONNECTION_PROFILE_IS_NOT_SELECTED=Connection profile is not selected
VALIDATOR_FACTORY_DRIVER_CLASS_PROPERTY_IS_EMPTY_FOR_SELECTED=Driver Class proberty is
empty for selected '
+VALIDATOR_FACTORY_SEAM_RT_SOURCE_TEMPLATES_DIR_DOES_NOT_EXIST=Seam Runtime
''{0}'' source templates directory doesn't exist for selected Seam Web
Project
VALIDATOR_FACTORY_CONNECTION_PROFILE=' connection profile
VALIDATOR_FACTORY_SEAM_RUNTIME_IS_NOT_SELECTED=Seam Runtime is not selected
+VALIDATOR_FACTORY_SEAM_RT_VIEW_DIR_IS_MISSING=Seam Runtime ''{0}'' view
templates directory doesn't exist
+VALIDATOR_FACTORY_SEAM_RT_CANNOT_BE_FOUND=Cannot find ''{0}'' Seam
Runtime for selected Seam Web Project
+VALIDATOR_FACTORY_CANNOT_FIND_SEAM_RUNTIME=Cannot find Seam Runtime
''{0}''
+VALIDATOR_FACTORY_SEAM_RT_SRC_DIR_IS_MISSING=Seam Runtime ''{0}'' source
templates directory doesn't exist
VALIDATOR_FACTORY_TEST_PROJECT=Test project '
VALIDATOR_FACTORY_EAR_PROJECT=EAR project '
VALIDATOR_FACTORY_EJB_PROJECT=EJB project '
VALIDATOR_FACTORY_PROJECT_ALREADY_EXISTS=' already exists. Please select other name
for new Seam project.
+VALIDATOR_FACTORY_SEAM_RT_NOT_CONFIGURED=Seam Runtime is not configured for selected Seam
Web Project
SEAM_PROJECT_WIZARD_PAGE1_FILE_CONTAINER_MUST_BE_SPECIFIED=File container must be
specified
SEAM_RUNTIME_LIST_FIELD_EDITOR_RUNTIME_NAME_IS_NOT_CORRECT=Runtime name is not correct
SEAM_GENERATE_ENTITIES_WIZARD_CAN_NOT_GENERATE_SEAM_ENTITIES=Can't generate seam
entities
@@ -173,4 +186,4 @@
SEAM_RUNTIME_LIST_FIELD_EDITOR_THE_SELECTED_SEAM_APPEARS_TO_BE_OF_INCOMATIBLE_VERSION=The
selected seam appears to be of an incompatible version '
SEAM_GENERATE_ENTITIES_WIZARD_THIS_METHOD_IS_NOT_RELEVANT_IN_GENERATING_SEAM_ENTITIES=This
method is not relevant in generating seam entities.
SEAM_FORM_WIZARD_PAGE1_JAVA_INTERFACE_SLSB_AND_KEY_SEAMEJB3_ANNOTATIONS_WILL_BE_CREATED=Java
Interface, SLSB and key Seam/EJB3 annotations will be created.
-SEAM_TARGET_RUNTIME=Target Server
\ No newline at end of file
+SEAM_TARGET_SERVER=Target Server
\ No newline at end of file
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-10-17
14:15:24 UTC (rev 4292)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-17
14:15:28 UTC (rev 4293)
@@ -11,8 +11,10 @@
package org.jboss.tools.seam.ui.wizard;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -30,11 +32,14 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
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.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -71,7 +76,7 @@
throws ExecutionException {
IStatus result = Status.OK_STATUS;
Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
Map<String, Object> vars = new HashMap<String, Object>();
@@ -104,7 +109,7 @@
vars.put(IParameter.SEAM_PROJECT_LOCATION_PATH,project.getLocation().toFile().toString());
vars.put(IParameter.SEAM_PROJECT_WEBCONTENT_PATH,webRootContainer.getLocation().toFile().toString());
- vars.put(IParameter.SEAM_EJB_PROJECT_LOCATION_PATH,seamPrjSet.getEjbProject().getLocation().toFile().toString());
+ vars.put(IParameter.SEAM_EJB_PROJECT_LOCATION_PATH,seamPrjSet.getEjbProject()!=null?seamPrjSet.getEjbProject().getLocation().toFile().toString():"");
vars.put(IParameter.SEAM_TEST_PROJECT_LOCATION_PATH,seamPrjSet.getTestProject().getLocation().toFile().toString());
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH,
actionFolder.replace('.','/'));
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME, actionFolder);
@@ -116,21 +121,31 @@
List<String[]> fileMapping = getFileMappings(vars);
List<String[]> fileMappingCopy = applayVariables(fileMapping,vars);
FilterSetCollection filters = getFilterSetCollection(vars);
- File[] file = new File[fileMappingCopy.size()];
+ final File[] file = new File[fileMappingCopy.size()];
int index=0;
for (String[] mapping : fileMappingCopy) {
file[index] = new File(mapping[1]);
FileUtils.getFileUtils().copyFile(new File(mapping[0]), file[index],filters,true);
index++;
}
-
seamPrjSet.refreshLocal(monitor);
-
- if(file.length > 0){
- IFile iFile = project.getWorkspace().getRoot().getFileForLocation(new
Path(file[0].getAbsolutePath()));
- IDE.openEditor(SeamGuiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(),
iFile);
- }
-
+ Display.getCurrent().asyncExec(new Runnable() {
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ // TODO Auto-generated method stub
+ if(file.length > 0){
+ IFile iFile = project.getWorkspace().getRoot().getFileForLocation(new
Path(file[0].getAbsolutePath()));
+ try {
+ IDE.openEditor(SeamGuiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(),
iFile);
+ } catch (PartInitException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ });
+
} catch (CoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
} catch (BackingStoreException e) {
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-10-17
14:15:24 UTC (rev 4292)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-10-17
14:15:28 UTC (rev 4293)
@@ -95,7 +95,13 @@
} else {
getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
}
- setPageComplete(false);
+ String selectdProject = getEditor(IParameter.SEAM_PROJECT_NAME).getValueAsString();
+
+ if(selectdProject!=null && !"".equals(selectdProject) &&
isValidProjectSelected()) {
+ isValidRuntimeConfigured(getSelectedProject());
+ } else {
+ setPageComplete(false);
+ }
}
/* (non-Javadoc)
@@ -187,16 +193,8 @@
*
*/
protected void doValidate(PropertyChangeEvent event) {
- Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
- editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue(), null);
+ if(!isValidProjectSelected()) return;
- if(errors.size()>0) {
- setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
- setPageComplete(false);
- getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
- return;
- }
-
IProject project = getSelectedProject();
getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(!isWar());
@@ -205,7 +203,7 @@
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);
- errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
+ Map errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
editorRegistry.get(IParameter.SEAM_COMPONENT_NAME).getValue(), null);
if(errors.size()>0) {
@@ -274,7 +272,7 @@
*/
protected boolean isValidRuntimeConfigured(IProject project) {
Map errors;
- String seamRt =
SeamCorePlugin.getSeamPreferences(project).get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,"war");
//$NON-NLS-1$
+ 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());
@@ -284,6 +282,19 @@
return true;
}
+ protected boolean isValidProjectSelected() {
+ 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);
+ getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
+ return false;
+ }
+ return true;
+ }
+
/**
*
*/
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-10-17
14:15:24 UTC (rev 4292)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2007-10-17
14:15:28 UTC (rev 4293)
@@ -157,7 +157,7 @@
protected void createSeamServerTargetComposite(Composite parent) {
// super.createServerTargetComposite(parent);
Group group = new Group(parent, SWT.NONE);
- group.setText(SeamUIMessages.SEAM_TARGET_RUNTIME);
+ group.setText(SeamUIMessages.SEAM_TARGET_SERVER);
group.setLayoutData(gdhfill());
group.setLayout(new GridLayout(2, false));