use of org.rstudio.core.client.command.AddinCommandBinding in project rstudio by rstudio.
the class AddinsCommandManager method registerBindings.
private void registerBindings(final EditorKeyBindings bindings, final CommandWithArg<EditorKeyBindings> afterLoad) {
List<Pair<List<KeySequence>, CommandBinding>> commands = new ArrayList<Pair<List<KeySequence>, CommandBinding>>();
RAddins rAddins = MainWindowObject.rAddins().get();
for (String id : bindings.iterableKeys()) {
List<KeySequence> keyList = bindings.get(id).getKeyBindings();
RAddin addin = rAddins.get(id);
if (addin == null)
continue;
CommandBinding binding = new AddinCommandBinding(addin);
commands.add(new Pair<List<KeySequence>, CommandBinding>(keyList, binding));
}
KeyMap map = ShortcutManager.INSTANCE.getKeyMap(KeyMapType.ADDIN);
for (int i = 0; i < commands.size(); i++) {
map.setBindings(commands.get(i).first, commands.get(i).second);
}
if (afterLoad != null)
afterLoad.execute(bindings);
}
Aggregations