Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Le Menez2015-11-16 10:12:48 -0500
committerGerrit Code Review @ Eclipse.org2016-07-05 07:34:03 -0400
commita48c48333e21d6fd32bf807d118c6b7631b86a83 (patch)
treef610d398280df2f5c6958c6bdcc8b543cf8628be
parenta74d91a377dc6494fd78c8723ac5db6eebb7c6f5 (diff)
downloadorg.eclipse.papyrus-a48c48333e21d6fd32bf807d118c6b7631b86a83.tar.gz
org.eclipse.papyrus-a48c48333e21d6fd32bf807d118c6b7631b86a83.tar.xz
org.eclipse.papyrus-a48c48333e21d6fd32bf807d118c6b7631b86a83.zip
Bug 482300: [Wizard] Should handle a null project name
https://bugs.eclipse.org/bugs/show_bug.cgi?id=482300 - Added a check on the project's name and an error message Change-Id: I3b8e16f5c89e3311f1626a8a1d7b21dc3f700941 Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/PapyrusProjectCreationPage.java9
3 files changed, 10 insertions, 2 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java
index 27a31c0e809..a88146a71ab 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java
@@ -53,6 +53,8 @@ public class Messages extends NLS {
public static String PapyrusProjectCreationPage_page_same_case_desc;
+ public static String PapyrusProjectCreationPage_page_null_name_desc;
+
/** The Diagram category registry_bad_class_name_of_category. */
public static String DiagramCategoryRegistry_bad_class_name_of_category;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties
index 264c046ac09..9ab758d72eb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties
@@ -26,6 +26,7 @@ NewPapyrusProjectWizard_new_papyrus_project=New Papyrus Project
NewPapyrusProjectWizard_papyrus_project=Papyrus Project
NewPapyrusProjectWizard_papyrus_project_desc=Create a New Papyrus Project
PapyrusProjectCreationPage_page_same_case_desc=There already is a project with this name:
+PapyrusProjectCreationPage_page_null_name_desc=The project's name is undefined, please provide one
DiagramCategoryRegistry_bad_class_name_of_category=Could not find implementation for a diagram category
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/PapyrusProjectCreationPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/PapyrusProjectCreationPage.java
index f1b56698b16..eecd4dc1ba3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/PapyrusProjectCreationPage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/PapyrusProjectCreationPage.java
@@ -112,11 +112,11 @@ public class PapyrusProjectCreationPage extends WizardNewProjectCreationPage {
// retrieve the selected elements and get its children
boolean canFlip = true;
- if (!validatePage()) {
+ if (!verifyProjectName()) {
canFlip = false;
}
- if (!verifyProjectName()) {
+ if (!validatePage()) {
canFlip = false;
}
@@ -127,6 +127,11 @@ public class PapyrusProjectCreationPage extends WizardNewProjectCreationPage {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (IProject iproject : projects) {
+ if (this.getProjectName() == null) {
+ this.setErrorMessage(Messages.PapyrusProjectCreationPage_page_null_name_desc);
+ // A conflict has been found, no need to go further
+ return false;
+ }
if (this.getProjectName().equalsIgnoreCase(iproject.getName())) {
this.setErrorMessage(Messages.PapyrusProjectCreationPage_page_same_case_desc + iproject.getName());
// A conflict has been found, no need to go further

Back to the top