mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git, hg: Add "Amend" prefix to "Commit and Push" actions if amend mode is on (IDEA-224798)
GitOrigin-RevId: aac2e894811cb6e97a2942e7bc5762ec743c1698
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8508588aa4
commit
c4d4a3f899
+5
@@ -7,6 +7,11 @@ import com.intellij.openapi.vcs.actions.getContextCommitWorkflowHandler
|
||||
import com.intellij.openapi.vcs.changes.CommitExecutor
|
||||
import com.intellij.vcs.commit.CommitWorkflowHandler
|
||||
|
||||
fun AnActionEvent.getAmendCommitModePrefix(): String {
|
||||
val isAmend = getContextCommitWorkflowHandler()?.amendCommitHandler?.isAmendCommitMode == true
|
||||
return if (isAmend) "Amend " else ""
|
||||
}
|
||||
|
||||
abstract class BaseCommitExecutorAction : DumbAwareAction() {
|
||||
init {
|
||||
isEnabledInModalContext = true
|
||||
|
||||
@@ -3,9 +3,16 @@
|
||||
|
||||
package git4idea.actions
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.vcs.changes.actions.BaseCommitExecutorAction
|
||||
import com.intellij.openapi.vcs.changes.actions.getAmendCommitModePrefix
|
||||
import git4idea.checkin.GitCommitAndPushExecutor
|
||||
|
||||
class GitCommitAndPushExecutorAction : BaseCommitExecutorAction() {
|
||||
override fun update(e: AnActionEvent) {
|
||||
super.update(e)
|
||||
e.presentation.text = e.getAmendCommitModePrefix() + templateText
|
||||
}
|
||||
|
||||
override val executorId: String = GitCommitAndPushExecutor.ID
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
// Copyright 2000-2018 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 org.zmlx.hg4idea.action
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.vcs.changes.actions.BaseCommitExecutorAction
|
||||
import com.intellij.openapi.vcs.changes.actions.getAmendCommitModePrefix
|
||||
import org.zmlx.hg4idea.provider.commit.HgCommitAndPushExecutor
|
||||
|
||||
class HgCommitAndPushExecutorAction : BaseCommitExecutorAction() {
|
||||
override fun update(e: AnActionEvent) {
|
||||
super.update(e)
|
||||
e.presentation.text = e.getAmendCommitModePrefix() + templateText
|
||||
}
|
||||
|
||||
override val executorId: String = HgCommitAndPushExecutor.ID
|
||||
}
|
||||
Reference in New Issue
Block a user