mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
copy file: use inserted name (IDEA-78106 ) [yole]
(cherry picked from commit ca9c57129e315a761373becce6a38d087b56fe68)
This commit is contained in:
@@ -177,6 +177,7 @@ public class CopyClassesHandler extends CopyHandlerDelegateBase {
|
||||
dialog.show();
|
||||
if (dialog.isOK()) {
|
||||
targetDirectory = dialog.getTargetDirectory();
|
||||
className = dialog.getNewName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,7 +338,13 @@ public class CopyClassesHandler extends CopyHandlerDelegateBase {
|
||||
}
|
||||
|
||||
private static PsiFile copy(@NotNull PsiFile file, PsiDirectory directory, String name, String relativePath) {
|
||||
final String fileName = name != null ? (name + "." + file.getViewProvider().getVirtualFile().getExtension()) : file.getName();
|
||||
final String fileName;
|
||||
if (name != null) {
|
||||
fileName = file instanceof PsiClassOwner ? name + "." + file.getViewProvider().getVirtualFile().getExtension() : name;
|
||||
}
|
||||
else {
|
||||
fileName = file.getName();
|
||||
}
|
||||
if (relativePath != null && !relativePath.isEmpty()) {
|
||||
return buildRelativeDir(directory, relativePath).findOrCreateTargetDirectory().copyFileFrom(fileName, file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user