vcs: non-modal: Use submenu to configure "show on double-click" behavior (IDEA-259716)
authorKonstantin Kolosovsky <konstantin.kolosovsky@jetbrains.com>
Thu, 14 Jan 2021 16:23:27 +0000 (19:23 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Tue, 19 Jan 2021 13:25:37 +0000 (13:25 +0000)
GitOrigin-RevId: c1ad32ccb68add51ed67b6d9cb0794cbb774d028

platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/vcs-impl/resources/META-INF/VcsActions.xml
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowOnDoubleClickToggleAction.kt [moved from platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowEditorPreviewOnDoubleClickToggleAction.kt with 66% similarity]

index 49a60cc30fe0cb71e1ff786a19faf39e6fee3023..8c5f93f0350c0942d0faa23fceabf49f4539e84c 100644 (file)
@@ -1446,7 +1446,11 @@ group.Shelve.KeymapGroup.text=Shelve
 action.Vcs.CopyRevisionNumberAction.text=Copy Revision Number
 action.Vcs.CopyRevisionNumberAction.description=Copy revision numbers of selected commits to the clipboard
 action.VcsToolbarLabelAction.text=VCS Label
-action.CommitView.ShowEditorPreviewOnDoubleClick.text=Show Diff Instead of File Content on Double-Click
+group.CommitView.ShowOnDoubleClick.text=Show on Double-Click
+action.CommitView.ShowOnDoubleClick.EditorPreview.text=Show Diff on Double-Click
+action.CommitView.ShowOnDoubleClick.EditorPreview.ToolwindowPopup.text=Diff
+action.CommitView.ShowOnDoubleClick.Source.text=Show Source on Double-Click
+action.CommitView.ShowOnDoubleClick.Source.ToolwindowPopup.text=Source
 action.CommitView.SwitchToCommitDialog.text=Switch to Commit Dialog
 action.Vcs.ToggleAmendCommitMode.text=Amend Commit
 action.Vcs.ToggleAmendCommitMode.description=Modify the latest commit of the current branch
index 275a154ddd32da33bdedd2d967e5f3874c45cece..b58dd279924a49f3dcfa777341fb1c0cd5e73c24 100644 (file)
 
     <group id="CommitView.GearActions">
       <action id="CommitView.SwitchToCommitDialog" class="com.intellij.vcs.commit.SwitchToCommitDialogAction"/>
-      <action id="CommitView.ShowEditorPreviewOnDoubleClick"
-              class="com.intellij.openapi.vcs.changes.actions.ShowEditorPreviewOnDoubleClickToggleAction"/>
+      <group id="CommitView.ShowOnDoubleClick" popup="true" searchable="false">
+        <action id="CommitView.ShowOnDoubleClick.EditorPreview"
+                class="com.intellij.openapi.vcs.changes.actions.ShowOnDoubleClickToggleAction$EditorPreview">
+          <override-text place="ToolwindowPopup"/>
+        </action>
+        <action id="CommitView.ShowOnDoubleClick.Source"
+                class="com.intellij.openapi.vcs.changes.actions.ShowOnDoubleClickToggleAction$Source">
+          <override-text place="ToolwindowPopup"/>
+        </action>
+      </group>
 
       <add-to-group group-id="VcsGeneral.KeymapGroup"/>
     </group>
similarity index 66%
rename from platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowEditorPreviewOnDoubleClickToggleAction.kt
rename to platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowOnDoubleClickToggleAction.kt
index 4760509581f2e8e03adc8b438b61cab8eaf807c9..fbe617ef7b5782f7ad21f9bf4e2a38b59b7ddf85 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2020 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.
+// Copyright 2000-2021 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.changes.actions
 
 import com.intellij.openapi.actionSystem.AnActionEvent
@@ -7,7 +7,7 @@ import com.intellij.openapi.vcs.VcsApplicationSettings
 import com.intellij.openapi.vcs.changes.ChangeListManager
 import com.intellij.openapi.vcs.changes.ChangesViewManager
 
-private class ShowEditorPreviewOnDoubleClickToggleAction : DumbAwareToggleAction() {
+private abstract class ShowOnDoubleClickToggleAction(private val isEditorPreview: Boolean) : DumbAwareToggleAction() {
   override fun update(e: AnActionEvent) {
     super.update(e)
 
@@ -18,9 +18,14 @@ private class ShowEditorPreviewOnDoubleClickToggleAction : DumbAwareToggleAction
       changesViewManager?.isEditorPreview == true || changeListManager?.areChangeListsEnabled() == false
   }
 
-  override fun isSelected(e: AnActionEvent): Boolean = VcsApplicationSettings.getInstance().SHOW_EDITOR_PREVIEW_ON_DOUBLE_CLICK
+  override fun isSelected(e: AnActionEvent): Boolean =
+    VcsApplicationSettings.getInstance().SHOW_EDITOR_PREVIEW_ON_DOUBLE_CLICK == isEditorPreview
 
   override fun setSelected(e: AnActionEvent, state: Boolean) {
-    VcsApplicationSettings.getInstance().SHOW_EDITOR_PREVIEW_ON_DOUBLE_CLICK = state
+    VcsApplicationSettings.getInstance().SHOW_EDITOR_PREVIEW_ON_DOUBLE_CLICK = isEditorPreview
   }
+
+  class EditorPreview : ShowOnDoubleClickToggleAction(true)
+
+  class Source : ShowOnDoubleClickToggleAction(false)
 }
\ No newline at end of file