diff: move EditorTabDiffPreview from [vcs-impl] to [diff-impl]

GitOrigin-RevId: ed7348283230288ac1aecbcc8999a44ef8e8d983
This commit is contained in:
Aleksey Pivovarov
2024-09-09 14:54:46 +02:00
committed by intellij-monorepo-bot
parent b2bc5e1223
commit 040628070c
13 changed files with 64 additions and 54 deletions

View File

@@ -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
- <init>(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
- <init>(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

View File

@@ -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<DiffRequest> DIFF_REQUEST_TO_COMPARE = DataKey.create("diff_request_to_compare");
DataKey<DiffPreview> EDITOR_TAB_DIFF_PREVIEW = DataKey.create("EditorTabDiffPreview");
}

View File

@@ -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)
}
}
}
}

View File

@@ -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<out
val producers = diffProducers.explicitSelection
return ExternalDiffTool.showIfNeeded(project, producers, DiffDialogHints.DEFAULT)
}
}

View File

@@ -5,6 +5,7 @@ import com.intellij.diff.editor.DiffEditorTabFilesManager
import com.intellij.diff.impl.DiffEditorViewer
import com.intellij.diff.impl.DiffRequestProcessor
import com.intellij.diff.impl.DiffRequestProcessorListener
import com.intellij.diff.tools.util.DiffDataKeys
import com.intellij.find.EditorSearchSession
import com.intellij.find.SearchTextArea
import com.intellij.find.editorHeaderActions.Utils
@@ -23,7 +24,6 @@ import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.NlsContexts
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.vcs.changes.EditorTabDiffPreview
import com.intellij.openapi.vcs.changes.EditorTabDiffPreviewManager
import com.intellij.openapi.vcs.changes.ui.TreeHandlerEditorDiffPreview
import com.intellij.openapi.wm.IdeFocusManager
import com.intellij.platform.lvcs.impl.*
@@ -171,7 +171,7 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ
override fun uiDataSnapshot(sink: DataSink) {
sink[ActivityViewDataKeys.SELECTION] = activityList.selection
sink[ActivityViewDataKeys.SCOPE] = activityScope
sink[EditorTabDiffPreviewManager.EDITOR_TAB_DIFF_PREVIEW] = editorDiffPreview
sink[DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW] = editorDiffPreview
sink[ActivityViewDataKeys.DIRECTORY_DIFF_MODE] = model.diffMode
}

View File

@@ -1431,17 +1431,6 @@ c:com.intellij.openapi.vcs.changes.DeletedFilesHolder
- hashCode():I
- isContainedInLocallyDeleted(com.intellij.openapi.vcs.FilePath):Z
- takeFrom(com.intellij.openapi.vcs.changes.DeletedFilesHolder):V
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
com.intellij.openapi.vcs.changes.DiffPreviewProvider
- a:createDiffRequestProcessor():com.intellij.diff.impl.DiffRequestProcessor
- a:getEditorTabName(com.intellij.diff.impl.DiffRequestProcessor):java.lang.String
@@ -1460,27 +1449,6 @@ a:com.intellij.openapi.vcs.changes.DnDActivateOnHoldTarget
- drop(com.intellij.ide.dnd.DnDEvent):V
- a:isDropPossible(com.intellij.ide.dnd.DnDEvent):Z
- update(com.intellij.ide.dnd.DnDEvent):Z
a:com.intellij.openapi.vcs.changes.EditorTabDiffPreview
- com.intellij.openapi.util.CheckedDisposable
- com.intellij.openapi.vcs.changes.DiffPreview
- <init>(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
- <init>():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

View File

@@ -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);
}

View File

@@ -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<DiffPreview>("EditorTabDiffPreview")
val EDITOR_TAB_DIFF_PREVIEW = DiffDataKeys.EDITOR_TAB_DIFF_PREVIEW
}
}

View File

@@ -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)
}

View File

@@ -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()

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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