mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
[rd] IJPL-191422 Fix missing icons for review mode
Apparently, setting `presentation.setIcon(null)` is crucial here. See IJPL-185353 for details. GitOrigin-RevId: dbe3d48faaedb4352504e4d4cf011cd7587eb8a2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b56c24001e
commit
1c69f36a18
@@ -27,7 +27,7 @@ interface GHPRBranchWidgetViewModel : GHPRReviewViewModel {
|
||||
|
||||
fun showPullRequest()
|
||||
fun updateBranch()
|
||||
fun toggleEditorReview()
|
||||
fun toggleEditorReview(enabled: Boolean)
|
||||
}
|
||||
|
||||
internal class GHPRBranchWidgetViewModelImpl(
|
||||
@@ -65,7 +65,7 @@ internal class GHPRBranchWidgetViewModelImpl(
|
||||
|
||||
override fun updateBranch() = sharedBranchVm.updateBranch()
|
||||
|
||||
override fun toggleEditorReview() {
|
||||
settings.editorReviewEnabled = !settings.editorReviewEnabled
|
||||
override fun toggleEditorReview(enabled: Boolean) {
|
||||
settings.editorReviewEnabled = enabled
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ import com.intellij.collaboration.ui.CollaborationToolsUIUtil
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.Toggleable
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.platform.util.coroutines.childScope
|
||||
@@ -125,17 +125,21 @@ class GHPROnCurrentBranchService(private val project: Project, parentCs: Corouti
|
||||
}
|
||||
}
|
||||
|
||||
class ToggleReviewAction : DumbAwareAction(), Toggleable {
|
||||
class ToggleReviewAction : DumbAwareToggleAction() {
|
||||
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
val vm = e.project?.getCurrentVm()
|
||||
e.presentation.isEnabledAndVisible = vm?.updateRequired?.value == false
|
||||
Toggleable.setSelected(e.presentation, vm?.editorReviewEnabled?.value ?: false)
|
||||
val enabledAndVisible = e.project?.getCurrentVm()?.updateRequired?.value == false
|
||||
e.presentation.isEnabledAndVisible = enabledAndVisible
|
||||
if (enabledAndVisible) {
|
||||
super.update(e)
|
||||
}
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
e.project?.getCurrentVm()?.toggleEditorReview()
|
||||
override fun isSelected(e: AnActionEvent): Boolean = e.project?.getCurrentVm()?.editorReviewEnabled?.value ?: false
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
e.project?.getCurrentVm()?.toggleEditorReview(state)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,14 +129,8 @@ class GitLabMergeRequestEditorReviewViewModel internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun toggleReviewMode() {
|
||||
val currentOption = discussionsViewOption.value
|
||||
val newOption = if (currentOption != DiscussionsViewOption.DONT_SHOW) {
|
||||
DiscussionsViewOption.DONT_SHOW
|
||||
}
|
||||
else {
|
||||
DiscussionsViewOption.UNRESOLVED_ONLY
|
||||
}
|
||||
fun toggleReviewMode(enabled: Boolean) {
|
||||
val newOption = if (enabled) DiscussionsViewOption.UNRESOLVED_ONLY else DiscussionsViewOption.DONT_SHOW
|
||||
setDiscussionsViewOption(newOption)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import com.intellij.collaboration.ui.codereview.diff.DiscussionsViewOption
|
||||
import com.intellij.collaboration.util.getOrNull
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.Toggleable
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.components.serviceIfCreated
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.vcs.gitlab.icons.GitlabIcons
|
||||
@@ -103,21 +103,25 @@ class GitLabMergeRequestOnCurrentBranchService(project: Project, cs: CoroutineSc
|
||||
}
|
||||
}
|
||||
|
||||
class ToggleReviewAction : DumbAwareAction(), Toggleable {
|
||||
class ToggleReviewAction : DumbAwareToggleAction() {
|
||||
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
val vm = e.project?.let(::getCurrentVm)
|
||||
if (vm == null || vm.localRepositorySyncStatus.value?.getOrNull()?.incoming == true) {
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
val enabledAndVisible = vm != null && vm.localRepositorySyncStatus.value?.getOrNull()?.incoming != true
|
||||
e.presentation.isEnabledAndVisible = enabledAndVisible
|
||||
if (enabledAndVisible) {
|
||||
super.update(e)
|
||||
}
|
||||
|
||||
Toggleable.setSelected(e.presentation, vm.discussionsViewOption.value != DiscussionsViewOption.DONT_SHOW)
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
e.project?.let(::getCurrentVm)?.toggleReviewMode()
|
||||
override fun isSelected(e: AnActionEvent): Boolean {
|
||||
val viewOption = e.project?.let(::getCurrentVm)?.discussionsViewOption?.value
|
||||
return viewOption != null && viewOption != DiscussionsViewOption.DONT_SHOW
|
||||
}
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
e.project?.let(::getCurrentVm)?.toggleReviewMode(state)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user