mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] IJPL-165734 Do not dispose editor content when invoking "Open tab in new window" action
(cherry picked from commit 1ad1e58e9bbe25f91b20f14c159b7458af1f5d64) IJ-CR-210789 GitOrigin-RevId: 1c75fc02a2349f49ef311f02c9ed2176cb120bc4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
051688f94d
commit
bce2b9ccf2
+10
-2
@@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.remoting.ActionRemoteBehaviorSpecification;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerKeys;
|
||||
import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -24,8 +25,15 @@ public final class EditSourceInNewWindowAction extends DumbAwareAction implement
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project == null) return;
|
||||
FileEditorManager manager = FileEditorManager.getInstance(project);
|
||||
((FileEditorManagerImpl)manager).openFileInNewWindow(getVirtualFiles(e)[0]);
|
||||
FileEditorManagerImpl manager = (FileEditorManagerImpl)FileEditorManager.getInstance(project);
|
||||
VirtualFile file = getVirtualFiles(e)[0];
|
||||
file.putUserData(FileEditorManagerKeys.CLOSING_TO_REOPEN, true);
|
||||
try {
|
||||
manager.openFileInNewWindow(file);
|
||||
}
|
||||
finally {
|
||||
file.putUserData(FileEditorManagerKeys.CLOSING_TO_REOPEN, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static VirtualFile[] getVirtualFiles(@NotNull AnActionEvent e) {
|
||||
|
||||
Reference in New Issue
Block a user