From 685ea31584211f86e652119c1e309ffc274d1777 Mon Sep 17 00:00:00 2001 From: Dmitry Zhuravlev Date: Fri, 30 Apr 2021 14:09:09 +0300 Subject: [PATCH] diff-preview: track "shouldOpenInNewWindow" only for diff preview files Otherwise, other files with persisted state (e.g., previously opened in the main editor) would change the state after project reopening. GitOrigin-RevId: 28f3573aa96dcca8a956019c143f2f15a8a8bea6 --- .../intellij/openapi/vcs/changes/VcsEditorTabFilesManager.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsEditorTabFilesManager.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsEditorTabFilesManager.kt index 57f422e7d345..f83fff6c1395 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsEditorTabFilesManager.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsEditorTabFilesManager.kt @@ -1,6 +1,7 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes +import com.intellij.diff.editor.DiffContentVirtualFile import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.* @@ -30,7 +31,8 @@ class VcsEditorTabFilesManager : val messageBus = ApplicationManager.getApplication().messageBus messageBus.connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, object : FileEditorManagerListener { override fun fileOpened(source: FileEditorManager, file: VirtualFile) { - if (source is FileEditorManagerEx) { + //currently shouldOpenInNewWindow is bound only to diff files + if (file is DiffContentVirtualFile && source is FileEditorManagerEx) { val isOpenInNewWindow = source.findFloatingWindowForFile(file) != null file.putUserData(OPENED_IN_NEW_WINDOW, if (isOpenInNewWindow) true else null) shouldOpenInNewWindow = isOpenInNewWindow