From 08e2f551466a4dd01cbc227323597baffa73d4fd Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 11 Mar 2014 18:18:57 +0400 Subject: [PATCH] refactoring - following CR-IC-4721 --- .../keymap/impl/ShortcutRestrictions.java | 32 +++++-------------- .../openapi/keymap/impl/ui/KeymapPanel.java | 6 ++-- .../keymap/impl/ui/MouseShortcutDialog.java | 2 +- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ShortcutRestrictions.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ShortcutRestrictions.java index f77589143856..1729dc94b93c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ShortcutRestrictions.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ShortcutRestrictions.java @@ -18,31 +18,15 @@ package com.intellij.openapi.keymap.impl; public class ShortcutRestrictions { public static final ShortcutRestrictions NO_RESTRICTIONS = new ShortcutRestrictions(true, true, true, true); - private final boolean myAllowMouseShortcut; - private final boolean myAllowMouseDoubleClick; - private final boolean myAllowKeyboardShortcut; - private final boolean myAllowAbbreviation; + public final boolean allowMouseShortcut; + public final boolean allowMouseDoubleClick; + public final boolean allowKeyboardShortcut; + public final boolean allowAbbreviation; public ShortcutRestrictions(boolean allowMouseShortcut, boolean allowMouseDoubleClick, boolean allowKeyboardShortcut, boolean allowAbbreviation) { - myAllowMouseShortcut = allowMouseShortcut; - myAllowMouseDoubleClick = allowMouseDoubleClick; - myAllowKeyboardShortcut = allowKeyboardShortcut; - myAllowAbbreviation = allowAbbreviation; - } - - public boolean allowMouseShortcut() { - return myAllowMouseShortcut; - } - - public boolean allowMouseDoubleClick() { - return myAllowMouseDoubleClick; - } - - public boolean allowKeyboardShortcut() { - return myAllowKeyboardShortcut; - } - - public boolean allowAbbreviation() { - return myAllowAbbreviation; + this.allowMouseShortcut = allowMouseShortcut; + this.allowMouseDoubleClick = allowMouseDoubleClick; + this.allowKeyboardShortcut = allowKeyboardShortcut; + this.allowAbbreviation = allowAbbreviation; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java index 03881edc628b..7756d8b401dd 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/KeymapPanel.java @@ -961,7 +961,7 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi final ShortcutRestrictions restrictions = ActionShortcutRestrictions.getForActionId(actionId); - if (restrictions.allowKeyboardShortcut()) { + if (restrictions.allowKeyboardShortcut) { group.add(new DumbAwareAction("Add Keyboard Shortcut") { @Override public void actionPerformed(AnActionEvent e) { @@ -978,7 +978,7 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi }); } - if (restrictions.allowMouseShortcut()) { + if (restrictions.allowMouseShortcut) { group.add(new DumbAwareAction("Add Mouse Shortcut") { @Override public void actionPerformed(AnActionEvent e) { @@ -994,7 +994,7 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi }); } - if (Registry.is("actionSystem.enableAbbreviations") && restrictions.allowAbbreviation()) { + if (Registry.is("actionSystem.enableAbbreviations") && restrictions.allowAbbreviation) { group.add(new DumbAwareAction("Add Abbreviation") { @Override public void actionPerformed(AnActionEvent e) { diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/MouseShortcutDialog.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/MouseShortcutDialog.java index 4a137f7b013c..92db22ea1f48 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/MouseShortcutDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/MouseShortcutDialog.java @@ -101,7 +101,7 @@ class MouseShortcutDialog extends DialogWrapper{ myModifiers=-1; } - myRbDoubleClick.setEnabled(restrictions.allowMouseDoubleClick()); + myRbDoubleClick.setEnabled(restrictions.allowMouseDoubleClick); updatePreviewAndConflicts();