本文整理汇总了Java中com.intellij.openapi.wm.IdeFocusManager.runOnOwnContext方法的典型用法代码示例。如果您正苦于以下问题:Java IdeFocusManager.runOnOwnContext方法的具体用法?Java IdeFocusManager.runOnOwnContext怎么用?Java IdeFocusManager.runOnOwnContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.wm.IdeFocusManager
的用法示例。
在下文中一共展示了IdeFocusManager.runOnOwnContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
});
}