use of org.rstudio.core.client.events.NativeKeyDownEvent in project rstudio by rstudio.
the class PresentationPane method handleKeyDown.
private void handleKeyDown(NativeEvent e) {
// get the event
NativeKeyDownEvent evt = new NativeKeyDownEvent(e);
// (only handle Esc)
if (activeZoomPanel_ != null) {
if (e.getKeyCode() == KeyCodes.KEY_ESCAPE) {
e.preventDefault();
e.stopPropagation();
activeZoomPanel_.close();
}
} else {
ShortcutManager.INSTANCE.onKeyDown(evt);
if (evt.isCanceled()) {
e.preventDefault();
e.stopPropagation();
// since this is a shortcut handled by the main window
// we set focus to it
WindowEx.get().focus();
}
}
}
use of org.rstudio.core.client.events.NativeKeyDownEvent in project rstudio by rstudio.
the class HelpPane method handleKeyDown.
// delegate shortcuts which occur while Help has focus
private void handleKeyDown(NativeEvent e) {
// determine whether this key-combination means we should focus find
int mod = KeyboardShortcut.getModifierValue(e);
if (mod == (BrowseCap.hasMetaKey() ? KeyboardShortcut.META : KeyboardShortcut.CTRL)) {
if (e.getKeyCode() == 'F') {
e.preventDefault();
e.stopPropagation();
WindowEx.get().focus();
findTextBox_.focus();
findTextBox_.selectAll();
return;
} else if (e.getKeyCode() == KeyCodes.KEY_ENTER) {
// extract the selected code, if any
String code = frame_.getWindow().getSelectedText();
if (code.isEmpty())
return;
// send it to the console
events_.fireEvent(new SendToConsoleEvent(code, // execute
true, // focus
false));
return;
}
}
// don't let backspace perform browser back
DomUtils.preventBackspaceCausingBrowserBack(e);
// delegate to the shortcut manager
NativeKeyDownEvent evt = new NativeKeyDownEvent(e);
ShortcutManager.INSTANCE.onKeyDown(evt);
if (evt.isCanceled()) {
e.preventDefault();
e.stopPropagation();
// since this is a shortcut handled by the main window
// we set focus to it
WindowEx.get().focus();
}
}
Aggregations