mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git-index: move three-side diff viewer to separate action
GitOrigin-RevId: dfb31b02561436848d43b9cd7adf1f3ffc54ac75
This commit is contained in:
committed by
intellij-monorepo-bot
parent
21d02a97f0
commit
70bef3e687
@@ -262,6 +262,7 @@
|
||||
<action id="Git.Stage.AcceptTheirs" class="git4idea.index.actions.GitAcceptTheirsAction"/>
|
||||
<action id="Git.Stage.AcceptYours" class="git4idea.index.actions.GitAcceptYoursAction"/>
|
||||
<action id="Git.Stage.Merge" class="git4idea.index.actions.GitMergeConflictAction"/>
|
||||
<action id="Git.Stage.ThreeSideDiff" class="git4idea.index.actions.GitStageThreeSideDiffAction" icon="AllIcons.Actions.Stub"/>
|
||||
|
||||
<action id="Git.Stash.Silently" class="git4idea.index.actions.GitStashSilentlyAction" icon="AllIcons.Vcs.ShelveSilent"/>
|
||||
|
||||
@@ -275,6 +276,7 @@
|
||||
<reference id="Git.Stage.AcceptTheirs"/>
|
||||
<reference id="Git.Stage.AcceptYours"/>
|
||||
<reference id="Git.Stage.Add"/>
|
||||
<reference id="Git.Stage.ThreeSideDiff"/>
|
||||
<reference id="Git.Stage.Reset"/>
|
||||
<reference id="Git.Stage.Revert"/>
|
||||
<reference id="$Delete"/>
|
||||
|
||||
@@ -614,6 +614,7 @@ action.NotificationAction.GithubNotifications.text.configure=Configure...
|
||||
action.NotificationAction.GitMergeAction.text.view.commits=View Commits
|
||||
action.NotificationAction.GitRewordOperation.text.undo=Undo
|
||||
action.NotificationAction.GitUpdateSession.text.view.commits=View Commits
|
||||
action.Git.Stage.ThreeSideDiff.text=Add Interactively...
|
||||
|
||||
settings.git.option.group=Git
|
||||
settings.commit.automatically.on.cherry.pick=Commit automatically on cherry-pick
|
||||
|
||||
@@ -5,9 +5,11 @@ import com.intellij.diff.DiffDialogHints
|
||||
import com.intellij.diff.DiffManager
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.AnActionExtensionProvider
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain
|
||||
import com.intellij.util.containers.isEmpty
|
||||
import git4idea.index.createThreeSidesDiffRequestProducer
|
||||
import git4idea.index.createTwoSidesDiffRequestProducer
|
||||
import git4idea.index.ui.GIT_FILE_STATUS_NODES_STREAM
|
||||
import git4idea.index.ui.GIT_STAGE_TRACKER
|
||||
import kotlin.streams.toList
|
||||
@@ -20,6 +22,18 @@ class GitStageDiffAction : AnActionExtensionProvider {
|
||||
e.presentation.isVisible = e.presentation.isEnabled || e.isFromActionToolbar
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val producers = e.getRequiredData(GIT_FILE_STATUS_NODES_STREAM).map { createTwoSidesDiffRequestProducer(e.project!!, it) }.toList()
|
||||
DiffManager.getInstance().showDiff(e.project, ChangeDiffRequestChain(producers, 0), DiffDialogHints.DEFAULT)
|
||||
}
|
||||
}
|
||||
|
||||
class GitStageThreeSideDiffAction : DumbAwareAction() {
|
||||
override fun update(e: AnActionEvent) {
|
||||
e.presentation.isEnabled = e.project != null && !e.getData(GIT_FILE_STATUS_NODES_STREAM).isEmpty()
|
||||
e.presentation.isVisible = e.presentation.isEnabled || e.isFromActionToolbar
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val producers = e.getRequiredData(GIT_FILE_STATUS_NODES_STREAM).map { createThreeSidesDiffRequestProducer(e.project!!, it) }.toList()
|
||||
DiffManager.getInstance().showDiff(e.project, ChangeDiffRequestChain(producers, 0), DiffDialogHints.DEFAULT)
|
||||
|
||||
Reference in New Issue
Block a user