BaseRefactoringProcessor (Project project, final PsiDirectory targetDirectory, PsiPackage aPackage, boolean searchInComments, boolean searchForTextOccurences) { final MoveDestination destination = createDestination(aPackage, targetDirectory); if (destination == null) return null; try { for (PsiDirectory dir: directories) { MoveFilesOrDirectoriesUtil.checkIfMoveIntoSelf(dir, WriteAction.compute(() -> destination.getTargetDirectory(dir))); } } catch (IncorrectOperationException e) { Messages.showErrorDialog(project, e.getMessage(), JavaRefactoringBundle.message("cannot.move")); return null; } return new MoveDirectoryWithClassesProcessor(project, directories, null, searchInComments, searchForTextOccurences, true, callback) { @NotNull @Override public TargetDirectoryWrapper getTargetDirectory(PsiDirectory dir) { final PsiDirectory targetDirectory = destination.getTargetDirectory(dir); return new TargetDirectoryWrapper(targetDirectory); } @Override protected String getTargetName() { return targetDirectory.getName(); } }; }