mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[copy] disable copy class when directory with a single class is selected (IDEA-301957)
GitOrigin-RevId: 57389a2bf5eb652e352298a6ceba515d40afa67c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8f22900554
commit
6bef5e0cbe
+4
-4
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.copy;
|
||||
|
||||
import com.intellij.codeInsight.actions.OptimizeImportsProcessor;
|
||||
@@ -203,7 +203,7 @@ public class CopyClassesHandler extends CopyHandlerDelegateBase {
|
||||
Object targetDirectory = null;
|
||||
String className = null;
|
||||
boolean openInEditor = true;
|
||||
if (copyOneClass(classes)) {
|
||||
if (copyOneClass(classes, elements)) {
|
||||
final String commonPath =
|
||||
ArrayUtilRt.find(elements, classes.values().iterator().next()) == -1 ? normalizeRelativeMap(relativePathsMap) : null;
|
||||
CopyClassDialog dialog = new CopyClassDialog(classes.values().iterator().next()[0], defaultTargetDirectory, project, false) {
|
||||
@@ -268,8 +268,8 @@ public class CopyClassesHandler extends CopyHandlerDelegateBase {
|
||||
CopyFilesOrDirectoriesHandler.copyAsFiles(files.toArray(PsiElement.EMPTY_ARRAY), defaultTargetDirectory, project);
|
||||
}
|
||||
|
||||
private static boolean copyOneClass(Map<PsiFile, PsiClass[]> classes) {
|
||||
if (classes.size() == 1) {
|
||||
private static boolean copyOneClass(Map<PsiFile, PsiClass[]> classes, PsiElement[] elements) {
|
||||
if (classes.size() == 1 && !(elements.length == 1 && elements[0] instanceof PsiDirectory)) {
|
||||
final PsiClass[] psiClasses = classes.values().iterator().next();
|
||||
return psiClasses != null && psiClasses.length == 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user