This commit is contained in:
Vladimir Krivosheev
2014-11-18 17:56:45 +01:00
parent f8239bef46
commit 4493d98ccd
2 changed files with 10 additions and 4 deletions
@@ -50,14 +50,17 @@ public class QuickAccessSettings implements ApplicationComponent, KeymapManagerL
@NonNls public static final String SWITCH_APPLY = "SwitchApply";
private RegistryValue myModifiersValue;
@Override
@NotNull
public String getComponentName() {
return "QuickAccess";
}
@Override
public void initComponent() {
myModifiersValue = Registry.get("actionSystem.quickAccessModifiers");
myModifiersValue.addListener(new RegistryValueListener.Adapter() {
@Override
public void afterValueChanged(RegistryValue value) {
applyModifiersFromRegistry();
}
@@ -71,14 +74,17 @@ public class QuickAccessSettings implements ApplicationComponent, KeymapManagerL
applyModifiersFromRegistry();
}
@Override
public void disposeComponent() {
KeymapManager.getInstance().removeKeymapManagerListener(this);
Disposer.dispose(this);
}
@Override
public void dispose() {
}
@Override
public void activeKeymapChanged(Keymap keymap) {
KeymapManager mgr = KeymapManager.getInstance();
myKeymap = mgr.getActiveKeymap();
@@ -89,7 +95,7 @@ public class QuickAccessSettings implements ApplicationComponent, KeymapManagerL
}
void saveModifiersToRegistry(Set<String> codeTexts) {
StringBuffer value = new StringBuffer();
StringBuilder value = new StringBuilder();
for (String each : codeTexts) {
if (value.length() > 0) {
value.append(" ");
@@ -109,7 +115,7 @@ public class QuickAccessSettings implements ApplicationComponent, KeymapManagerL
HashSet<String> vksSet = new HashSet<String>();
ContainerUtil.addAll(vksSet, vks);
myModifierVks.clear();
int mask = getModiferMask(vksSet);
int mask = getModifierMask(vksSet);
myModifierVks.addAll(getModifiersVKs(mask));
reassignActionShortcut(SWITCH_UP, mask, KeyEvent.VK_UP);
@@ -147,7 +153,7 @@ public class QuickAccessSettings implements ApplicationComponent, KeymapManagerL
}
@JdkConstants.InputEventMask
int getModiferMask(Set<String> codeTexts) {
int getModifierMask(Set<String> codeTexts) {
int mask = 0;
for (String each : codeTexts) {
if ("control".equals(each)) {
@@ -199,7 +199,7 @@ public class QuickAccessConfigurable extends JPanel implements SearchableConfigu
private boolean printConflict(GridBagConstraints c, int actionKey, String actionId) {
boolean hasConflicts = false;
int mask = myQuickAccessSettings.getModiferMask(myModifiers);
int mask = myQuickAccessSettings.getModifierMask(myModifiers);
KeyboardShortcut sc = new KeyboardShortcut(KeyStroke.getKeyStroke(actionKey, mask), null);