void () { final String path = FileUtil.toSystemIndependentName(myDestDirectoryField.getText()); final Project project = myDirectory.getProject(); PsiDirectory directory = WriteAction.compute(() -> { try { return DirectoryUtil.mkdirs(PsiManager.getInstance(project), path); } catch (IncorrectOperationException e) { LOG.error(e); return null; } }); if (directory == null) { Messages.showErrorDialog(project, JavaRefactoringBundle.message("cannot.find.or.create.destination.directory"), JavaRefactoringBundle.message("cannot.move")); return; } final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory); if (aPackage == null) { Messages.showErrorDialog(project, JavaRefactoringBundle.message("destination.directory.does.not.correspond.to.any.package"), JavaRefactoringBundle.message("cannot.move")); return; } final JavaRefactoringSettings refactoringSettings = JavaRefactoringSettings.getInstance(); final boolean searchInComments = isSearchInComments(); final boolean searchForTextOccurences = isSearchInNonJavaFiles(); refactoringSettings.MOVE_SEARCH_IN_COMMENTS = searchInComments; refactoringSettings.MOVE_SEARCH_FOR_TEXT = searchForTextOccurences; final BaseRefactoringProcessor refactoringProcessor = createRefactoringProcessor(project, directory, aPackage, searchInComments, searchForTextOccurences); if (refactoringProcessor != null) { invokeRefactoring(refactoringProcessor); } }