vcs: Fix action text if "AbstractCommonCheckinAction.getActionName()" is null - use template presentation text

This commit is contained in:
Konstantin Kolosovsky
2019-01-15 21:29:25 +03:00
parent 15094e94f1
commit dcd069e43c
5 changed files with 4 additions and 15 deletions
@@ -248,7 +248,7 @@ action.Diff.PreviousConflict.description=Move to the previous unresolved conflic
action.GotoChangedFile.text=Go To Changed File...
action.GotoChangedFile.description=Quickly navigate to changed file by name
action.Refresh.text=R_efresh
action.CheckinProject.text=Comm_it
action.CheckinProject.text=Comm_it...
action.CheckinFiles.text=Comm_it File
action.CheckinFiles.description=Commit selected files or directories
action.UpdateFiles.text=_Update
@@ -33,7 +33,7 @@ abstract class AbstractCommonCheckinAction : AbstractVcsAction(), UpdateInBackgr
presentation.isEnabled = false
}
else {
presentation.text = "${getActionName(vcsContext)}..."
getActionName(vcsContext)?.let { presentation.text = "$it..." }
presentation.isEnabled = !ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning
presentation.isVisible = true
}
@@ -41,13 +41,13 @@ abstract class AbstractCommonCheckinAction : AbstractVcsAction(), UpdateInBackgr
protected abstract fun approximatelyHasRoots(dataContext: VcsContext): Boolean
protected abstract fun getActionName(dataContext: VcsContext): String?
protected open fun getActionName(dataContext: VcsContext): String? = null
public override fun actionPerformed(context: VcsContext) {
LOG.debug("actionPerformed. ")
val project = context.project!!
val actionName = getActionName(context)?.let { removeMnemonic(it) }
val actionName = getActionName(context)?.let { removeMnemonic(it) } ?: templatePresentation.text
val isFreezedDialogTitle = actionName?.let { "Can not $it now" }
if (ChangeListManager.getInstance(project).isFreezedWithNotification(isFreezedDialogTitle)) {
@@ -1,7 +1,6 @@
// 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.
package com.intellij.openapi.vcs.actions
import com.intellij.idea.ActionsBundle
import com.intellij.openapi.vcs.FilePath
import com.intellij.openapi.vcs.ProjectLevelVcsManager
import com.intellij.vcsUtil.VcsUtil.getFilePath
@@ -14,6 +13,4 @@ open class CommonCheckinProjectAction : AbstractCommonCheckinAction() {
.toTypedArray()
override fun approximatelyHasRoots(dataContext: VcsContext): Boolean = true
override fun getActionName(dataContext: VcsContext): String = ActionsBundle.message("action.CheckinProject.text")
}
@@ -3,13 +3,9 @@
package com.intellij.openapi.vcs.changes.actions
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.VcsBundle
import com.intellij.openapi.vcs.actions.VcsContext
import com.intellij.openapi.vcs.changes.CommitExecutor
import com.intellij.openapi.vcs.changes.patch.CreatePatchCommitExecutor
class CreatePatchAction : AbstractCommitChangesAction() {
override fun getActionName(dataContext: VcsContext): String = VcsBundle.message("create.patch.commit.action.title")
override fun getExecutor(project: Project): CommitExecutor? = CreatePatchCommitExecutor.getInstance(project)
}
@@ -3,13 +3,9 @@
package com.intellij.openapi.vcs.changes.shelf
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.VcsBundle
import com.intellij.openapi.vcs.actions.VcsContext
import com.intellij.openapi.vcs.changes.CommitExecutor
import com.intellij.openapi.vcs.changes.actions.AbstractCommitChangesAction
class ShelveChangesAction : AbstractCommitChangesAction() {
override fun getActionName(dataContext: VcsContext): String = VcsBundle.message("shelve.changes.action")
override fun getExecutor(project: Project): CommitExecutor = ShelveChangesCommitExecutor(project)
}