mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add API to let Rider customize the mnemonic of Tools menu (RIDER-25142)
GitOrigin-RevId: 620a09ce8745bf42d730744d80bc4f79dbb15496
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7e0d3ac588
commit
dc5ac03585
@@ -0,0 +1,22 @@
|
||||
// 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.ide
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.ui.IdeUICustomization
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
class IdeDependentActionGroup : DefaultActionGroup() {
|
||||
private val id by lazy { ActionManager.getInstance().getId(this) }
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
super.update(e)
|
||||
val actionText = IdeUICustomization.getInstance().getActionText(id)
|
||||
if (actionText != null) {
|
||||
e.presentation.text = actionText
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ package com.intellij.ui;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Allows to apply IDE-specific customizations to the terms used in platform UI features.
|
||||
@@ -57,4 +59,12 @@ public class IdeUICustomization {
|
||||
public String getSelectAutopopupByCharsText() {
|
||||
return "Insert selected suggestion by pressing space, dot, or other context-dependent keys";
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to replace the text of the given action (only for the actions/groups that support this mechanism)
|
||||
*/
|
||||
@Nullable
|
||||
public String getActionText(@NotNull String actionId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@
|
||||
</group>
|
||||
|
||||
<!-- Tools -->
|
||||
<group id="ToolsMenu" popup="true" compact="true">
|
||||
<group id="ToolsMenu" popup="true" compact="true" class="com.intellij.ide.IdeDependentActionGroup">
|
||||
<action id="PsiViewer" class="com.intellij.internal.psiView.PsiViewerAction"/>
|
||||
<action id="PsiViewerForContext" class="com.intellij.internal.psiView.PsiViewerAction$ForContext"/>
|
||||
<separator/>
|
||||
|
||||
Reference in New Issue
Block a user