Exception (final VirtualFile parentDirectory, final String newFolderName) { final Exception[] failReason = new Exception[]{null}; CommandProcessor.getInstance().executeCommand( myProject, new Runnable() { @Override public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { try { VirtualFile parent = parentDirectory; for (String name : StringUtil.tokenize(newFolderName, "\\/")) { VirtualFile folder = parent.createChildDirectory(this, name); updateTree(); select(folder, null); parent = folder; } } catch (IOException e) { failReason[0] = e; } } }); } }, UIBundle.message("file.chooser.create.new.folder.command.name"), null ); return failReason[0]; }