mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-165089 reset keymap actions to parent, not to original values
This commit is contained in:
@@ -54,7 +54,7 @@ final class KeymapScheme implements Scheme {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
Keymap getCurrent() {
|
||||
KeymapImpl getCurrent() {
|
||||
return mutable != null ? mutable : original;
|
||||
}
|
||||
|
||||
@@ -83,26 +83,21 @@ final class KeymapScheme implements Scheme {
|
||||
}
|
||||
|
||||
boolean canReset() {
|
||||
return mutable != null && !mutable.equals(original);
|
||||
return getCurrent().getOwnActionIds().length > 0;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
assert canReset() : "reset all modified shortcuts unexpectedly";
|
||||
mutable = null;
|
||||
getMutable().clearOwnActionsIds();
|
||||
}
|
||||
|
||||
boolean canReset(@NotNull String actionId) {
|
||||
return mutable != null && !deepEquals(original.getShortcuts(actionId), mutable.getShortcuts(actionId));
|
||||
return getCurrent().hasOwnActionId(actionId);
|
||||
}
|
||||
|
||||
void reset(@NotNull String actionId) {
|
||||
assert canReset(actionId) : "reset modified action shortcuts unexpectedly";
|
||||
if (mutable != null) {
|
||||
mutable.removeAllActionShortcuts(actionId);
|
||||
for (Shortcut shortcut : original.getShortcuts(actionId)) {
|
||||
mutable.addShortcut(actionId, shortcut);
|
||||
}
|
||||
}
|
||||
getMutable().clearOwnActionsId(actionId);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -104,7 +104,9 @@ final class KeymapSelector extends SimpleSchemesPanel<KeymapScheme> implements S
|
||||
|
||||
void resetActionInKeymap(Keymap mutable, String actionId) {
|
||||
KeymapScheme scheme = find(mutable);
|
||||
if (scheme != null) scheme.reset(actionId);
|
||||
if (scheme == null) return;
|
||||
scheme.reset(actionId);
|
||||
selectKeymap(scheme, false);
|
||||
}
|
||||
|
||||
private KeymapScheme find(Keymap keymap) {
|
||||
|
||||
Reference in New Issue
Block a user