/*
- * 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.
* 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;
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
// 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();
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(