]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/AddResultFolder.java
Migrate SLC modules
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui / src / main / java / org / argeo / slc / client / ui / commands / AddResultFolder.java
index dc61fc47786f1da0efbe2a63abfc8ed74d6dbc3c..8c2839a0d87d1e494bfcd6c0e9dfac8e5af165e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2012 Mathieu Baudier
+ * Copyright (C) 2007-2012 Argeo GmbH
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.argeo.slc.client.ui.commands;
 
 import javax.jcr.Node;
@@ -41,7 +40,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 public class AddResultFolder extends AbstractHandler {
        public final static String ID = ClientUiPlugin.ID + ".addResultFolder";
        public final static String DEFAULT_ICON_REL_PATH = "icons/addFolder.gif";
-       public final static String DEFAULT_LABEL = "New result folder";
+       public final static String DEFAULT_LABEL = "Add folder...";
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
                IStructuredSelection selection = (IStructuredSelection) HandlerUtil
@@ -51,10 +50,8 @@ public class AddResultFolder extends AbstractHandler {
                // menu.
                if (selection != null && selection.size() == 1) {
                        Object obj = selection.getFirstElement();
-
                        try {
                                Node parentNode = null;
-
                                if (obj instanceof ResultFolder) {
                                        ResultFolder rf = (ResultFolder) obj;
                                        parentNode = rf.getNode();
@@ -70,6 +67,12 @@ public class AddResultFolder extends AbstractHandler {
                                        String folderName = SingleValue.ask("Folder name",
                                                        "Enter folder name");
                                        if (folderName != null) {
+                                               if (folderName.contains("/")) {
+                                                       ErrorFeedback
+                                                                       .show("Folder names can't contain a '/'.");
+                                                       return null;
+                                               }
+
                                                String absPath = parentNode.getPath() + "/"
                                                                + folderName;
                                                SlcJcrResultUtils.createResultFolderNode(