refactoring - following CR-IC-4721

This commit is contained in:
Dmitry Batrak
2014-03-11 18:19:40 +04:00
parent c415007970
commit 08e2f55146
3 changed files with 12 additions and 28 deletions
@@ -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;
}
}
@@ -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) {
@@ -101,7 +101,7 @@ class MouseShortcutDialog extends DialogWrapper{
myModifiers=-1;
}
myRbDoubleClick.setEnabled(restrictions.allowMouseDoubleClick());
myRbDoubleClick.setEnabled(restrictions.allowMouseDoubleClick);
updatePreviewAndConflicts();