+ nodeSession = nodeRepository.login();
+ Node repoNode = nodeSession.getNode(targetRepoPath);
+ Repository repository = RepoUtils.getRepository(repositoryFactory,
+ keyring, repoNode);
+ Credentials credentials = RepoUtils.getRepositoryCredentials(
+ keyring, repoNode);
+
+ // TODO : add an input validator
+ InputDialog inputDialog = new InputDialog(HandlerUtil
+ .getActiveWorkbenchWindow(event).getShell(),
+ "Workspace name?",
+ "Choose a name for the workspace to create",
+ prefix == null ? "" : prefix + "-", null);
+ int result = inputDialog.open();
+
+ String enteredName = inputDialog.getValue();
+
+ final String legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXZY0123456789_";
+ char[] arr = enteredName.toUpperCase().toCharArray();
+ int count = 0;
+ for (int i = 0; i < arr.length; i++) {
+ if (legalChars.indexOf(arr[i]) == -1)
+ count = count + 7;
+ else
+ count++;
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Count " + count);
+
+ if (count > 60) {
+ ErrorFeedback.show("Workspace name '" + enteredName
+ + "' is too long or contains"
+ + " too many special characters such as '.' or '-'.");
+ return null;
+ }
+
+ String workspaceName = enteredName;
+
+ // Canceled by user
+ if (result == Dialog.CANCEL || workspaceName == null
+ || "".equals(workspaceName.trim()))
+ return null;
+
+ session = repository.login(credentials);