Promise<Object> (final @NotNull PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); Project project = context.getProject(); PsiManagerImpl myPsiManager = (PsiManagerImpl)PsiManager.getInstance(project); String input = extractCommandArgument(PREFIX); String[] lineAndColumn = input.split(" "); final String sourcePath = lineAndColumn[0]; final String targetPath = lineAndColumn[1]; VirtualFile projectDir = ProjectUtil.guessProjectDir(project); if(projectDir != null) { VirtualFile sourceVirtualFile = projectDir.findFileByRelativePath(sourcePath); VirtualFile targetVirtualFile = projectDir.findFileByRelativePath(targetPath); if(sourceVirtualFile != null && targetVirtualFile != null) { final PsiDirectory sourcePsiDir = myPsiManager.findDirectory(sourceVirtualFile); final PsiDirectory targetPsiDir = myPsiManager.findDirectory(targetVirtualFile); ApplicationManager.getApplication().invokeAndWait(() -> WriteCommandAction.writeCommandAction(project).run(() -> { MoveFilesOrDirectoriesUtil.doMoveDirectory(sourcePsiDir, targetPsiDir); LOG.info("Dir " + sourcePath + " has been moved to " + targetPath); actionCallback.setDone(); }), ModalityState.nonModal()); } else { actionCallback.reject("Source or target dir is not found"); } } else { actionCallback.reject("Project dir can't be guessed"); } return Promises.toPromise(actionCallback); }