mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
copy: initialize initial target directory based on target selected, avoids changing current project in case of 2 open (IDEA-142307)
This commit is contained in:
@@ -25,10 +25,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiDirectoryContainer;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.copy.CopyHandler;
|
||||
import com.intellij.refactoring.move.MoveCallback;
|
||||
@@ -164,6 +161,12 @@ public abstract class CopyPasteDelegator implements CopyPasteSupport {
|
||||
targetDirectory.putCopyableUserData(SHOW_CHOOSER_KEY, directories.length > 1);
|
||||
}
|
||||
}
|
||||
if (targetDirectory == null && target != null) {
|
||||
final PsiFile containingFile = target.getContainingFile();
|
||||
if (containingFile != null) {
|
||||
targetDirectory = containingFile.getContainingDirectory();
|
||||
}
|
||||
}
|
||||
if (CopyHandler.canCopy(elements)) {
|
||||
CopyHandler.doCopy(elements, targetDirectory);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user