[jbosstools-commits] JBoss Tools SVN: r43501 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 7 07:24:49 EDT 2012


Author: adietish
Date: 2012-09-07 07:24:49 -0400 (Fri, 07 Sep 2012)
New Revision: 43501

Modified:
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java
Log:
[JBIDE-12211] checking name validity before looking project up in workspace

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java	2012-09-07 09:28:59 UTC (rev 43500)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java	2012-09-07 11:24:49 UTC (rev 43501)
@@ -81,4 +81,8 @@
 		return true;
 	}
 	
+	public static boolean isEmptyOrNull(String value) {
+		return value == null
+				|| value.isEmpty();
+	}
 }

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java	2012-09-07 09:28:59 UTC (rev 43500)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java	2012-09-07 11:24:49 UTC (rev 43501)
@@ -34,7 +34,6 @@
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jgit.util.StringUtils;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -49,6 +48,7 @@
 import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
 import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
 import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
 
 /**
  * @author Andre Dietisheim
@@ -277,9 +277,12 @@
 				final String applicationName = (String) applicationNameObservable.getValue();
 				if (StringUtils.isEmptyOrNull(applicationName)) {
 					status = OpenShiftUIActivator.createErrorStatus("You have to choose an application name");
+				} else if (!StringUtils.isAlphaNumeric(applicationName)) {
+					status = OpenShiftUIActivator.createErrorStatus(
+							"The name may only contain lower-case letters and digits.");
 				} else {
 					final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(applicationName);
-					if(project.exists()) {
+					if (project.exists()) {
 						status = OpenShiftUIActivator.createErrorStatus(
 								NLS.bind("A project named {0} already exists in the workspace.", applicationName));
 					}



More information about the jbosstools-commits mailing list