void (PsiElement element) { PsiDirectory targetDirectory; if (element instanceof PsiDirectory) { targetDirectory = ((PsiDirectory)element).getParentDirectory(); } else { targetDirectory = PlatformPackageUtil.getDirectory(element); } targetDirectory = tryNotNullizeDirectory(element.getProject(), targetDirectory); if (targetDirectory == null) return; PsiElement[] elements = {element}; VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile(); CopyFilesOrDirectoriesDialog dialog = new CopyFilesOrDirectoriesDialog(elements, null, element.getProject(), true); if (dialog.showAndGet()) { String newName = dialog.getNewName(); copyImpl(new VirtualFile[] {file}, newName, targetDirectory, true, true); } }