mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ui: check that bound actions do not have assigned shortcuts
This commit is contained in:
@@ -66,9 +66,6 @@
|
||||
<action id="EditorJoinLines">
|
||||
<keyboard-shortcut first-keystroke="control shift J"/>
|
||||
</action>
|
||||
<action id="EditorChooseLookupItemCompleteStatement">
|
||||
<keyboard-shortcut first-keystroke="control shift ENTER"/>
|
||||
</action>
|
||||
<action id="EditorChooseLookupItemDot">
|
||||
<keyboard-shortcut first-keystroke="control PERIOD"/></action>
|
||||
<action id="EditorCompleteStatement">
|
||||
|
||||
@@ -156,23 +156,8 @@
|
||||
</action>
|
||||
<action id="GotoSuperMethod"/>
|
||||
<action id="GotoTypeDeclaration"/>
|
||||
<action id="Graph.Faces.OpenSelectedPages">
|
||||
<keyboard-shortcut first-keystroke="F12"/>
|
||||
<keyboard-shortcut first-keystroke="shift control E"/>
|
||||
</action>
|
||||
<action id="GuiDesigner.CreateComponent">
|
||||
<keyboard-shortcut first-keystroke="meta N"/>
|
||||
</action>
|
||||
<action id="GuiDesigner.CreateListener"/>
|
||||
<action id="GuiDesigner.Duplicate">
|
||||
<keyboard-shortcut first-keystroke="meta alt UP"/>
|
||||
<keyboard-shortcut first-keystroke="meta alt DOWN"/>
|
||||
</action>
|
||||
<action id="GuiDesigner.EditComponent"/>
|
||||
<action id="GuiDesigner.EditGroup"/>
|
||||
<action id="GuiDesigner.GoToListener">
|
||||
<keyboard-shortcut first-keystroke="meta T"/>
|
||||
</action>
|
||||
<action id="HighlightUsagesInFile"/> <!-- TODO -->
|
||||
<action id="IDEtalk.Rename"/>
|
||||
<action id="Images.ShowThumbnails"/>
|
||||
|
||||
@@ -182,24 +182,8 @@
|
||||
</action>
|
||||
<action id="GotoSuperMethod"/>
|
||||
<action id="GotoTypeDeclaration"/>
|
||||
<action id="Graph.Faces.OpenSelectedPages">
|
||||
<keyboard-shortcut first-keystroke="F12"/>
|
||||
<keyboard-shortcut first-keystroke="shift control E"/>
|
||||
</action>
|
||||
<action id="GuiDesigner.CreateComponent">
|
||||
<keyboard-shortcut first-keystroke="alt INSERT"/>
|
||||
</action>
|
||||
<action id="GuiDesigner.CreateListener"/>
|
||||
<action id="GuiDesigner.Duplicate">
|
||||
<keyboard-shortcut first-keystroke="control alt UP"/>
|
||||
<keyboard-shortcut first-keystroke="control alt DOWN"/>
|
||||
</action>
|
||||
<action id="GuiDesigner.EditComponent"/>
|
||||
<action id="GuiDesigner.EditGroup"/>
|
||||
<action id="GuiDesigner.GoToListener">
|
||||
<keyboard-shortcut first-keystroke="control T"/>
|
||||
<keyboard-shortcut first-keystroke="control alt B"/>
|
||||
</action>
|
||||
<action id="HighlightUsagesInFile">
|
||||
<keyboard-shortcut first-keystroke="shift alt O"/>
|
||||
<keyboard-shortcut first-keystroke="shift control F7"/>
|
||||
|
||||
@@ -153,15 +153,9 @@
|
||||
<action id="TypeHierarchy">
|
||||
<keyboard-shortcut first-keystroke="control E" second-keystroke="H"/>
|
||||
</action>
|
||||
<action id="TypeHierarchyBase.BaseOnThisType">
|
||||
<keyboard-shortcut first-keystroke="meta UP"/>
|
||||
</action>
|
||||
<action id="Unscramble">
|
||||
<keyboard-shortcut first-keystroke="control E" second-keystroke="T"/>
|
||||
</action>
|
||||
<action id="UsageView.ShowRecentFindUsages">
|
||||
<keyboard-shortcut first-keystroke="control COMMA"/>
|
||||
</action>
|
||||
<action id="Vcs.ShowMessageHistory">
|
||||
<keyboard-shortcut first-keystroke="control M"/>
|
||||
</action>
|
||||
|
||||
@@ -72,12 +72,6 @@
|
||||
<action id="SurroundWithLiveTemplate">
|
||||
<keyboard-shortcut first-keystroke="control E" second-keystroke="U"/>
|
||||
</action>
|
||||
<action id="TypeHierarchyBase.BaseOnThisType">
|
||||
<keyboard-shortcut first-keystroke="meta UP"/>
|
||||
</action>
|
||||
<action id="UsageView.ShowRecentFindUsages">
|
||||
<keyboard-shortcut first-keystroke="control COMMA"/>
|
||||
</action>
|
||||
<action id="Vcs.ShowMessageHistory">
|
||||
<keyboard-shortcut first-keystroke="control M"/>
|
||||
</action>
|
||||
|
||||
@@ -97,9 +97,6 @@
|
||||
<action id="Print">
|
||||
<keyboard-shortcut first-keystroke="control P"/>
|
||||
</action>
|
||||
<action id="PropertyInspectorActions.AddProperty">
|
||||
<keyboard-shortcut first-keystroke="alt INSERT"/>
|
||||
</action>
|
||||
<action id="ImplementMethods">
|
||||
<keyboard-shortcut first-keystroke="shift control I"/>
|
||||
</action>
|
||||
|
||||
@@ -65,12 +65,6 @@
|
||||
<action id="Compare.SameVersion">
|
||||
<keyboard-shortcut first-keystroke="alt shift meta ENTER"/>
|
||||
</action>
|
||||
<action id="Diff.NextChange">
|
||||
<keyboard-shortcut first-keystroke="shift meta CLOSE_BRACKET"/>
|
||||
</action>
|
||||
<action id="Diff.PrevChange">
|
||||
<keyboard-shortcut first-keystroke="shift meta OPEN_BRACKET"/>
|
||||
</action>
|
||||
<action id="DuplicatesForm.SendToLeft"/>
|
||||
<action id="DuplicatesForm.SendToRight"/>
|
||||
|
||||
@@ -355,9 +349,6 @@
|
||||
<keyboard-shortcut first-keystroke="shift meta J"/>
|
||||
<keyboard-shortcut first-keystroke="alt F1"/>
|
||||
</action>
|
||||
<action id="ShelvedChanges.Rename">
|
||||
<keyboard-shortcut first-keystroke="shift F6"/>
|
||||
</action>
|
||||
<action id="ShowNavBar">
|
||||
<keyboard-shortcut first-keystroke="control 5"/>
|
||||
<keyboard-shortcut first-keystroke="alt HOME"/>
|
||||
@@ -443,7 +434,6 @@
|
||||
<action id="Vcs.UpdateProject">
|
||||
<keyboard-shortcut first-keystroke="alt meta X"/>
|
||||
</action>
|
||||
<action id="UsageView.ShowRecentFindUsages"/>
|
||||
<action id="Vcs.ShowMessageHistory">
|
||||
<keyboard-shortcut first-keystroke="control M"/>
|
||||
</action>
|
||||
|
||||
@@ -34,6 +34,11 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
|
||||
result.addAll(UNCNOWN_ACTION_IDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getBoundActions() {
|
||||
return DEFAULT_BOUND_ACTIONS;
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
@NonNls @SuppressWarnings({"HardCodedStringLiteral"})
|
||||
private static final Map<String, String[][]> DEFAULT_DUPLICATES = new THashMap<String, String[][]>(){{
|
||||
@@ -361,4 +366,8 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
|
||||
"IDEtalk.SearchUserHistory", "IDEtalk.SearchUserHistory", "IDEtalk.Rename",
|
||||
""
|
||||
);
|
||||
|
||||
@NonNls protected static final Set<String> DEFAULT_BOUND_ACTIONS = ContainerUtil.set(
|
||||
"EditorDelete"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ public abstract class KeymapsTestCaseBase extends PlatformTestCase {
|
||||
|
||||
protected abstract void collectUnknownActions(Set<String> result);
|
||||
|
||||
protected abstract Set<String> getBoundActions();
|
||||
|
||||
protected static void appendKnownDuplicates(Map<String, Map<String, List<String>>> result, Map<String, String[][]> duplicates) {
|
||||
for (Map.Entry<String, String[][]> eachKeymap : duplicates.entrySet()) {
|
||||
String keymapName = eachKeymap.getKey();
|
||||
@@ -398,4 +400,42 @@ public abstract class KeymapsTestCaseBase extends PlatformTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testBoundActions() {
|
||||
StringBuilder failMessage = new StringBuilder();
|
||||
|
||||
Set<String> knownBoundActions = getBoundActions();
|
||||
|
||||
Keymap[] keymaps = KeymapManagerEx.getInstanceEx().getAllKeymaps();
|
||||
for (Keymap keymap : keymaps) {
|
||||
KeymapImpl keymapImpl = (KeymapImpl)keymap;
|
||||
List<String> unboundActionsWithShortcut = new ArrayList<>();
|
||||
|
||||
for (String actionId : keymapImpl.getActionIds()) {
|
||||
if (knownBoundActions.contains(actionId)) continue;
|
||||
|
||||
Shortcut[] ownShortcuts = keymapImpl.getOwnShortcuts(actionId);
|
||||
boolean isBound = keymapImpl.isActionBound(actionId);
|
||||
|
||||
if (isBound && ownShortcuts != null) {
|
||||
unboundActionsWithShortcut.add(actionId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!unboundActionsWithShortcut.isEmpty()) {
|
||||
failMessage.append(String.format("Shortcut for bound action found in keymap '%s':\n", keymap));
|
||||
for (String action : unboundActionsWithShortcut) {
|
||||
failMessage.append(" \"").append(action).append("\"\n");
|
||||
}
|
||||
failMessage.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (failMessage.length() > 0) {
|
||||
TestCase.fail(failMessage +
|
||||
"\n" +
|
||||
"Please remove these actions from keymaps, or add to the 'known bound actions' list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1651,9 +1651,7 @@
|
||||
<actions>
|
||||
<action id="Groovy.Shell.Execute" class="com.intellij.openapi.actionSystem.EmptyAction" use-shortcut-of="Console.Execute.Multiline"
|
||||
text="Execute Groovy Code"
|
||||
description="Execute Groovy code in console">
|
||||
<keyboard-shortcut first-keystroke="control ENTER" keymap="$default"/>
|
||||
</action>
|
||||
description="Execute Groovy code in console"/>
|
||||
|
||||
<group id="Groovy.CheckResources" class="org.jetbrains.plugins.groovy.compiler.CheckResourcesAction$Group"
|
||||
popup="true"
|
||||
|
||||
Reference in New Issue
Block a user