本文整理汇总了Java中com.intellij.openapi.wm.IdeFocusManager.typeAheadUntil方法的典型用法代码示例。如果您正苦于以下问题:Java IdeFocusManager.typeAheadUntil方法的具体用法?Java IdeFocusManager.typeAheadUntil怎么用?Java IdeFocusManager.typeAheadUntil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.wm.IdeFocusManager
的用法示例。
在下文中一共展示了IdeFocusManager.typeAheadUntil方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@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(new Runnable() {
@Override
public void run() {
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) {
}
}
});
}
}
示例2: actionPerformed
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(final ActionEvent e) {
final IdeFocusManager fm = IdeFocusManager.findInstanceByContext(myContext);
final ActionCallback typeAhead = new ActionCallback();
final String id = ActionManager.getInstance().getId(myAction.getAction());
if (id != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("context.menu.click.stats." + id.replace(' ', '.'));
}
fm.typeAheadUntil(typeAhead);
fm.runOnOwnContext(myContext, new Runnable() {
@Override
public void run() {
final AnActionEvent event = new AnActionEvent(
new MouseEvent(ActionMenuItem.this, MouseEvent.MOUSE_PRESSED, 0, e.getModifiers(), getWidth() / 2, getHeight() / 2, 1, false),
myContext, myPlace, myPresentation, ActionManager.getInstance(), e.getModifiers()
);
final AnAction action = myAction.getAction();
if (ActionUtil.lastUpdateAndCheckDumb(action, event, false)) {
ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
actionManager.fireBeforeActionPerformed(action, myContext, event);
Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(event.getDataContext());
if (component != null && !isInTree(component)) {
typeAhead.setDone();
return;
}
SimpleTimer.getInstance().setUp(new Runnable() {
@Override
public void run() {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fm.doWhenFocusSettlesDown(typeAhead.createSetDoneRunnable());
}
});
}
}, Registry.intValue("actionSystem.typeAheadTimeAfterPopupAction"));
ActionUtil.performActionDumbAware(action, event);
actionManager.queueActionPerformedEvent(action, myContext, event);
}
else {
typeAhead.setDone();
}
}
});
}