void (final Project project, final PsiElement[] elements, final PsiElement[] targetElement, final MoveCallback moveCallback, final Function<? super PsiElement[], ? extends PsiElement[]> adjustElements) { if (adjustElements == null) { for (PsiElement element : elements) { if (!(element instanceof PsiFile) && !(element instanceof PsiDirectory)) { throw new IllegalArgumentException("unexpected element type: " + element); } } } final PsiDirectory targetDirectory = resolveToDirectory(project, targetElement[0]); if (targetElement[0] != null && targetDirectory == null) return; final PsiElement[] adjustedElements = adjustElements != null ? adjustElements.fun(elements) : elements; final PsiDirectory initialTargetDirectory = getInitialTargetDirectory(targetDirectory, elements); if (ApplicationManager.getApplication().isUnitTestMode()) { Objects.requireNonNull(initialTargetDirectory, "It is null! The target directory, it is null!"); doMove(project, elements, adjustedElements, initialTargetDirectory, moveCallback, EmptyRunnable.INSTANCE); } else { new MoveFilesOrDirectoriesDialog(project, adjustedElements, initialTargetDirectory) { @Override protected void performMove(@NotNull PsiDirectory targetDirectory) { Runnable doneCallback = this::closeOKAction; doMove(project, elements, adjustedElements, targetDirectory, moveCallback, doneCallback); } }.show(); } }