cwm: fix empty diff preview in remote development

CLM refresh event might come with host ClientId, while preview file
is opened for unattended guest.

GitOrigin-RevId: 0ec0256062fd9eda3f3c2d9db2a06b42e5d08e05
This commit is contained in:
Aleksey Pivovarov
2022-02-09 12:03:23 +00:00
committed by intellij-monorepo-bot
parent 380fbc3be2
commit a43c389c46
2 changed files with 11 additions and 2 deletions
@@ -93,6 +93,15 @@ public abstract class FileEditorManager {
*/
public abstract boolean isFileOpen(@NotNull VirtualFile file);
/**
* @return {@code true} if {@code file} is opened, {@code false} otherwise
* Unlike {@link #isFileOpen(VirtualFile)} includes files which were opened by all guests during a collaborative development session.
*/
@ApiStatus.Experimental
public boolean isFileOpenWithRemotes(@NotNull VirtualFile file) {
return isFileOpen(file);
}
/**
* @return all opened files. Order of files in the array corresponds to the order of editor tabs.
*/
@@ -263,5 +272,5 @@ public abstract class FileEditorManager {
*
* @param file the file to refresh.
*/
public void updateFilePresentation(@NotNull VirtualFile file) {}
public void updateFilePresentation(@NotNull VirtualFile file) { }
}
@@ -132,7 +132,7 @@ abstract class EditorTabPreview(protected val diffProcessor: DiffRequestProcesso
if (isPreviewVisible) openPreview(focus) else closePreview()
}
protected fun isPreviewOpen(): Boolean = FileEditorManager.getInstance(project).isFileOpen(previewFile)
protected fun isPreviewOpen(): Boolean = FileEditorManager.getInstance(project).isFileOpenWithRemotes(previewFile)
fun closePreview() {
FileEditorManager.getInstance(project).closeFile(previewFile)