git: fix i18n warnings
[idea/community.git] / plugins / git4idea / src / git4idea / checkin / GitCommitAndPushExecutor.kt
1 // Copyright 2000-2019 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.
2 package git4idea.checkin
3
4 import com.intellij.openapi.util.Key
5 import com.intellij.openapi.vcs.changes.CommitContext
6 import com.intellij.openapi.vcs.changes.CommitExecutor
7 import com.intellij.openapi.vcs.changes.CommitSession
8 import com.intellij.vcs.commit.commitProperty
9 import git4idea.i18n.GitBundle
10 import org.jetbrains.annotations.Nls
11
12 private val IS_PUSH_AFTER_COMMIT_KEY = Key.create<Boolean>("Git.Commit.IsPushAfterCommit")
13 internal var CommitContext.isPushAfterCommit: Boolean by commitProperty(IS_PUSH_AFTER_COMMIT_KEY)
14
15 class GitCommitAndPushExecutor : CommitExecutor {
16   @Nls
17   override fun getActionText(): String = GitBundle.message("action.Git.Commit.And.Push.Executor.text")
18
19   override fun useDefaultAction(): Boolean = false
20
21   override fun getId(): String = ID
22
23   override fun supportsPartialCommit(): Boolean = true
24
25   override fun createCommitSession(commitContext: CommitContext): CommitSession {
26     commitContext.isPushAfterCommit = true
27     return CommitSession.VCS_COMMIT
28   }
29
30   companion object {
31     internal const val ID = "Git.Commit.And.Push.Executor"
32   }
33 }