use of org.rstudio.studio.client.server.remote.ExecuteUserCommandEvent in project rstudio by rstudio.
the class UserCommandManager method onRegisterUserCommand.
private void onRegisterUserCommand(RegisterUserCommandEvent event) {
final String name = event.getData().getName();
JsArrayString shortcutStrings = event.getData().getShortcuts();
for (int i = 0; i < shortcutStrings.length(); i++) {
String shortcutString = shortcutStrings.get(i);
KeySequence sequence = KeySequence.fromShortcutString(shortcutString);
assert sequence != null : "Failed to parse string '" + shortcutString + "'";
KeyboardShortcut shortcut = new KeyboardShortcut(sequence);
UserCommand command = new UserCommand(name, new Command() {
@Override
public void execute() {
events_.fireEvent(new ExecuteUserCommandEvent(name));
}
});
commandMap_.put(shortcut, command);
}
}
Aggregations