diff --git a/platform/diff-impl/resources/api-dump.txt b/platform/diff-impl/resources/api-dump.txt index 8174d1eb6cc6..1965699adbc9 100644 --- a/platform/diff-impl/resources/api-dump.txt +++ b/platform/diff-impl/resources/api-dump.txt @@ -1566,6 +1566,7 @@ com.intellij.diff.tools.util.DiffDataKeys - sf:DIFF_REQUEST_TO_COMPARE:com.intellij.openapi.actionSystem.DataKey - sf:DIFF_VIEWER:com.intellij.openapi.actionSystem.DataKey - sf:EDITOR_CHANGED_RANGE_PROVIDER:com.intellij.openapi.actionSystem.DataKey +- sf:EDITOR_TAB_DIFF_PREVIEW:com.intellij.openapi.actionSystem.DataKey - sf:MERGE_VIEWER:com.intellij.openapi.actionSystem.DataKey - sf:NAVIGATABLE:com.intellij.openapi.actionSystem.DataKey - sf:NAVIGATABLE_ARRAY:com.intellij.openapi.actionSystem.DataKey @@ -2989,6 +2990,38 @@ c:com.intellij.openapi.diff.LineStatusMarkerDrawUtil$DiffStripeTextAttributes - (B):V - getErrorStripeColor():java.awt.Color - getType():B +com.intellij.openapi.vcs.changes.DiffPreview +- sf:Companion:com.intellij.openapi.vcs.changes.DiffPreview$Companion +- a:closePreview():V +- s:closePreviewFile(com.intellij.openapi.project.Project,com.intellij.openapi.vfs.VirtualFile):V +- a:openPreview(Z):Z +- performDiffAction():Z +- s:setPreviewVisible(com.intellij.openapi.vcs.changes.DiffPreview,Z):V +- updateDiffAction(com.intellij.openapi.actionSystem.AnActionEvent):V +f:com.intellij.openapi.vcs.changes.DiffPreview$Companion +- f:closePreviewFile(com.intellij.openapi.project.Project,com.intellij.openapi.vfs.VirtualFile):V +- f:setPreviewVisible(com.intellij.openapi.vcs.changes.DiffPreview,Z):V +a:com.intellij.openapi.vcs.changes.EditorTabDiffPreview +- com.intellij.openapi.util.CheckedDisposable +- com.intellij.openapi.vcs.changes.DiffPreview +- (com.intellij.openapi.project.Project):V +- closePreview():V +- pa:collectDiffProducers(Z):com.intellij.openapi.ListSelection +- createEscapeHandler():com.intellij.openapi.actionSystem.AnAction +- pa:createViewer():com.intellij.diff.impl.DiffEditorViewer +- dispose():V +- pa:getEditorTabName(com.intellij.diff.impl.DiffEditorViewer):java.lang.String +- f:getPreviewFile():com.intellij.openapi.vfs.VirtualFile +- f:getProject():com.intellij.openapi.project.Project +- p:handleEscapeKey():V +- a:hasContent():Z +- isDisposed():Z +- f:isPreviewOpen():Z +- openPreview(Z):Z +- performDiffAction():Z +- updateDiffAction(com.intellij.openapi.actionSystem.AnActionEvent):V +f:com.intellij.openapi.vcs.changes.EditorTabDiffPreviewKt +- sf:showExternalToolIfNeeded(com.intellij.openapi.project.Project,com.intellij.openapi.ListSelection):Z a:com.intellij.openapi.vcs.ex.ActiveLineStatusGutterMarkerRenderer - com.intellij.openapi.vcs.ex.LineStatusGutterMarkerRenderer - com.intellij.openapi.editor.markup.ActiveGutterRenderer diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/DiffDataKeys.java b/platform/diff-impl/src/com/intellij/diff/tools/util/DiffDataKeys.java index 0d15387f768e..ed5c268f14f7 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/DiffDataKeys.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/DiffDataKeys.java @@ -24,6 +24,7 @@ import com.intellij.diff.util.LineRange; import com.intellij.openapi.actionSystem.AnActionExtensionProvider; import com.intellij.openapi.actionSystem.DataKey; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.vcs.changes.DiffPreview; import com.intellij.pom.Navigatable; public interface DiffDataKeys { @@ -56,4 +57,6 @@ public interface DiffDataKeys { * See also {@link com.intellij.diff.actions.ShowDiffAction} and {@link AnActionExtensionProvider} for more flexibility. */ DataKey DIFF_REQUEST_TO_COMPARE = DataKey.create("diff_request_to_compare"); + + DataKey EDITOR_TAB_DIFF_PREVIEW = DataKey.create("EditorTabDiffPreview"); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DiffPreview.kt b/platform/diff-impl/src/com/intellij/openapi/vcs/changes/DiffPreview.kt similarity index 89% rename from platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DiffPreview.kt rename to platform/diff-impl/src/com/intellij/openapi/vcs/changes/DiffPreview.kt index e860159e22d5..7cc57d6e5e67 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DiffPreview.kt +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/changes/DiffPreview.kt @@ -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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.changes import com.intellij.openapi.actionSystem.AnActionEvent @@ -42,4 +42,4 @@ interface DiffPreview { editorManager.closeFile(previewFile, closeAllCopies = true, moveFocus = true) } } -} +} \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreview.kt b/platform/diff-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreview.kt similarity index 91% rename from platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreview.kt rename to platform/diff-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreview.kt index c1153e7f9a8b..64703150f4d5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreview.kt +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreview.kt @@ -3,7 +3,12 @@ package com.intellij.openapi.vcs.changes import com.intellij.diff.DiffDialogHints import com.intellij.diff.chains.DiffRequestProducer -import com.intellij.diff.editor.* +import com.intellij.diff.editor.DiffEditorEscapeAction +import com.intellij.diff.editor.DiffEditorTabFilesManager +import com.intellij.diff.editor.DiffEditorViewerFileEditor +import com.intellij.diff.editor.DiffViewerVirtualFile +import com.intellij.diff.editor.DiffVirtualFileWithProducers +import com.intellij.diff.editor.DiffVirtualFileWithTabName import com.intellij.diff.impl.DiffEditorViewer import com.intellij.diff.tools.external.ExternalDiffTool import com.intellij.openapi.ListSelection @@ -17,7 +22,6 @@ import com.intellij.openapi.project.DumbAwareAction import com.intellij.openapi.project.Project import com.intellij.openapi.util.CheckedDisposable import com.intellij.openapi.util.Disposer -import com.intellij.openapi.vcs.changes.EditorTabPreviewBase.Companion.showExternalToolIfNeeded import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.annotations.Nls import java.lang.ref.WeakReference @@ -48,7 +52,7 @@ abstract class EditorTabDiffPreview(val project: Project) : CheckedDisposable, D override fun openPreview(requestFocus: Boolean): Boolean { if (!hasContent()) return false - DiffEditorTabFilesManager.getInstance(project).showDiffFile(previewFile, requestFocus) + DiffEditorTabFilesManager.Companion.getInstance(project).showDiffFile(previewFile, requestFocus) return true } @@ -138,4 +142,4 @@ fun showExternalToolIfNeeded(project: Project?, diffProducers: ListSelection(com.intellij.openapi.project.Project):V -- closePreview():V -- pa:collectDiffProducers(Z):com.intellij.openapi.ListSelection -- createEscapeHandler():com.intellij.openapi.actionSystem.AnAction -- pa:createViewer():com.intellij.diff.impl.DiffEditorViewer -- dispose():V -- pa:getEditorTabName(com.intellij.diff.impl.DiffEditorViewer):java.lang.String -- f:getPreviewFile():com.intellij.openapi.vfs.VirtualFile -- f:getProject():com.intellij.openapi.project.Project -- p:handleEscapeKey():V -- a:hasContent():Z -- isDisposed():Z -- f:isPreviewOpen():Z -- openPreview(Z):Z -- performDiffAction():Z -- updateDiffAction(com.intellij.openapi.actionSystem.AnActionEvent):V -f:com.intellij.openapi.vcs.changes.EditorTabDiffPreviewKt -- sf:showExternalToolIfNeeded(com.intellij.openapi.project.Project,com.intellij.openapi.ListSelection):Z f:com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager - sf:Companion:com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager$Companion - sf:EDITOR_TAB_DIFF_PREVIEW:com.intellij.openapi.actionSystem.DataKey @@ -1790,13 +1758,11 @@ f:com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager - sf:Companion:com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager$Companion - ():V - dispose():V -- sf:findFloatingWindowForFile(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx,com.intellij.openapi.vfs.VirtualFile):com.intellij.openapi.fileEditor.impl.EditorWindow - sf:getInstance():com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager - f:getShouldOpenInNewWindow():Z - f:openFile(com.intellij.openapi.project.Project,com.intellij.openapi.vfs.VirtualFile,Z):java.util.List - f:openFile(com.intellij.openapi.project.Project,com.intellij.openapi.vfs.VirtualFile,Z,Z,Z):java.util.List f:com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager$Companion -- f:findFloatingWindowForFile(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx,com.intellij.openapi.vfs.VirtualFile):com.intellij.openapi.fileEditor.impl.EditorWindow - f:getInstance():com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager f:com.intellij.openapi.vcs.changes.VcsEditorTabFilesManager$State - com.intellij.openapi.components.BaseState diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java index 84b2162f5ff1..4aa7a9a91d52 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java @@ -5,6 +5,7 @@ package com.intellij.openapi.vcs.changes; import com.intellij.diagnostic.Activity; import com.intellij.diagnostic.StartUpMeasurer; import com.intellij.diff.impl.DiffEditorViewer; +import com.intellij.diff.tools.util.DiffDataKeys; import com.intellij.diff.util.DiffUtil; import com.intellij.icons.AllIcons; import com.intellij.ide.CommonActionsManager; @@ -732,7 +733,7 @@ public class ChangesViewManager implements ChangesViewEx, @Override public void uiDataSnapshot(@NotNull DataSink sink) { super.uiDataSnapshot(sink); - sink.set(EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW, myEditorDiffPreview); + sink.set(DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW, myEditorDiffPreview); // This makes COMMIT_WORKFLOW_HANDLER available anywhere in "Local Changes" - so commit executor actions are enabled. DataSink.uiDataSnapshot(sink, myCommitPanel); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreviewManager.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreviewManager.kt index 160727a45c61..515eec3c92c7 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreviewManager.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/EditorTabDiffPreviewManager.kt @@ -1,8 +1,8 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.changes +import com.intellij.diff.tools.util.DiffDataKeys import com.intellij.openapi.Disposable -import com.intellij.openapi.actionSystem.DataKey import com.intellij.openapi.project.Project import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManagerListener @@ -19,7 +19,8 @@ class EditorTabDiffPreviewManager(private val project: Project) { } companion object { + @Deprecated("Use DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW instead") @JvmField - val EDITOR_TAB_DIFF_PREVIEW = DataKey.create("EditorTabDiffPreview") + val EDITOR_TAB_DIFF_PREVIEW = DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShowEditorDiffPreviewActionProvider.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShowEditorDiffPreviewActionProvider.kt index 82e29de580a3..590c65c256dd 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShowEditorDiffPreviewActionProvider.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShowEditorDiffPreviewActionProvider.kt @@ -1,11 +1,11 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.changes +import com.intellij.diff.tools.util.DiffDataKeys import com.intellij.idea.ActionsBundle.message import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.AnActionExtensionProvider -import com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager.Companion.EDITOR_TAB_DIFF_PREVIEW internal class ShowEditorDiffPreviewActionProvider : AnActionExtensionProvider { override fun isActive(e: AnActionEvent): Boolean { @@ -30,5 +30,5 @@ internal class ShowEditorDiffPreviewActionProvider : AnActionExtensionProvider { diffPreview.performDiffAction() } - private fun getDiffPreview(e: AnActionEvent) = e.getData(EDITOR_TAB_DIFF_PREVIEW) + private fun getDiffPreview(e: AnActionEvent): DiffPreview? = e.getData(DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW) } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt index 1b5ec8d7dfdb..74bf66db08d8 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt @@ -1,13 +1,13 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.changes.savedPatches +import com.intellij.diff.tools.util.DiffDataKeys import com.intellij.icons.AllIcons import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.* import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer import com.intellij.openapi.vcs.VcsBundle -import com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager import com.intellij.ui.* import com.intellij.util.EditSourceOnDoubleClickHandler import com.intellij.util.Processor @@ -172,7 +172,7 @@ open class SavedPatchesUi(project: Project, } override fun uiDataSnapshot(sink: DataSink) { - sink[EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW] = editorTabPreview + sink[DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW] = editorTabPreview sink[SAVED_PATCH_SELECTED_PATCH] = selectedPatchObjectOrNull() sink[SAVED_PATCHES_UI] = this sink[SAVED_PATCH_CHANGES] = changesBrowser.getSavedPatchChanges() diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java index 07f3400bee72..b3bb059b83e7 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java @@ -7,6 +7,7 @@ import com.intellij.diff.FrameDiffTool; import com.intellij.diff.chains.DiffRequestProducer; import com.intellij.diff.impl.DiffEditorViewer; import com.intellij.diff.requests.DiffRequest; +import com.intellij.diff.tools.util.DiffDataKeys; import com.intellij.diff.util.DiffPlaces; import com.intellij.ide.DataManager; import com.intellij.ide.DeleteProvider; @@ -905,7 +906,7 @@ public class ShelvedChangesViewManager implements Disposable { @Override public void uiDataSnapshot(@NotNull DataSink sink) { super.uiDataSnapshot(sink); - sink.set(EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW, myEditorDiffPreview); + sink.set(DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW, myEditorDiffPreview); } private class MyToggleDetailsAction extends ShowDiffPreviewAction { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java index d9242f1a3ff9..6f39828cd1cd 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java @@ -2,6 +2,7 @@ package com.intellij.vcs.log.history; import com.intellij.diff.impl.DiffEditorViewer; +import com.intellij.diff.tools.util.DiffDataKeys; import com.intellij.diff.util.DiffUtil; import com.intellij.ide.ui.customization.CustomActionsSchema; import com.intellij.openapi.Disposable; @@ -13,7 +14,6 @@ import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsDataKeys; import com.intellij.openapi.vcs.changes.Change; -import com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager; import com.intellij.openapi.vcs.history.VcsFileRevision; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.GuiUtils; @@ -272,7 +272,7 @@ class FileHistoryPanel extends JPanel implements UiDataProvider, Disposable { sink.set(VcsLogInternalDataKeys.VCS_LOG_VISIBLE_ROOTS, Collections.singleton(myRoot)); sink.set(VcsDataKeys.VCS_NON_LOCAL_HISTORY_SESSION, false); sink.set(VcsLogInternalDataKeys.LOG_DIFF_HANDLER, myFileHistoryModel.getDiffHandler()); - sink.set(EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW, myEditorDiffPreview); + sink.set(DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW, myEditorDiffPreview); sink.set(VcsLogInternalDataKeys.FILE_HISTORY_MODEL, myFileHistoryModel.createSnapshot()); sink.set(QuickActionProvider.KEY, new ComponentQuickActionProvider(this)); sink.set(PlatformCoreDataKeys.HELP_ID, HELP_ID); diff --git a/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt b/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt index ca64a3600837..e6064663db9b 100644 --- a/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt +++ b/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt @@ -1,6 +1,7 @@ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package git4idea.index.ui +import com.intellij.diff.tools.util.DiffDataKeys import com.intellij.diff.util.DiffUtil import com.intellij.dvcs.ui.RepositoryChangesBrowserNode import com.intellij.icons.AllIcons @@ -215,7 +216,7 @@ internal class GitStagePanel( override fun uiDataSnapshot(sink: DataSink) { sink[QuickActionProvider.KEY] = toolbar as? QuickActionProvider - sink[EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW] = editorTabPreview + sink[DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW] = editorTabPreview sink[PlatformDataKeys.HELP_ID] = HELP_ID // This makes COMMIT_WORKFLOW_HANDLER available anywhere in "Local Changes" - so commit executor actions are enabled. @@ -328,7 +329,7 @@ internal class GitStagePanel( override fun isSelected(e: AnActionEvent): Boolean { return VcsConfiguration.getInstance(project).LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN } - + override fun setSelected(e: AnActionEvent, state: Boolean) { VcsConfiguration.getInstance(project).LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN = state