use of com.intellij.openapi.wm.IdeFocusManager in project intellij-community by JetBrains.
the class NavBarListener method keyPressed.
@Override
public void keyPressed(final KeyEvent e) {
if (!(e.isAltDown() || e.isMetaDown() || e.isControlDown() || myPanel.isNodePopupActive())) {
if (!Character.isLetter(e.getKeyChar())) {
return;
}
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myPanel.getProject());
final ActionCallback firstCharTyped = new ActionCallback();
focusManager.typeAheadUntil(firstCharTyped);
myPanel.moveDown();
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> {
try {
final Robot robot = new Robot();
final boolean shiftOn = e.isShiftDown();
final int code = e.getKeyCode();
if (shiftOn) {
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(code);
robot.keyRelease(code);
//don't release Shift
firstCharTyped.setDone();
} catch (AWTException ignored) {
}
});
}
}
use of com.intellij.openapi.wm.IdeFocusManager in project android by JetBrains.
the class ThemeSelectionPanel method focus.
public void focus() {
final Project project = myConfiguration.getModule().getProject();
final IdeFocusManager focusManager = project.isDefault() ? IdeFocusManager.getGlobalInstance() : IdeFocusManager.getInstance(project);
focusManager.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
focusManager.requestFocus(myThemeList, true);
}
});
}
Aggregations