本文整理汇总了Java中com.intellij.openapi.wm.IdeFocusManager.doWhenFocusSettlesDown方法的典型用法代码示例。如果您正苦于以下问题:Java IdeFocusManager.doWhenFocusSettlesDown方法的具体用法?Java IdeFocusManager.doWhenFocusSettlesDown怎么用?Java IdeFocusManager.doWhenFocusSettlesDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.wm.IdeFocusManager
的用法示例。
在下文中一共展示了IdeFocusManager.doWhenFocusSettlesDown方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hide
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void hide() {
super.hide();
if (myFocusTrackback != null && !(myFocusTrackback.isSheduledForRestore() || myFocusTrackback.isWillBeSheduledForRestore())) {
myFocusTrackback.setWillBeSheduledForRestore();
IdeFocusManager mgr = getFocusManager();
Runnable r = new Runnable() {
@Override
public void run() {
if (myFocusTrackback != null) myFocusTrackback.restoreFocus();
myFocusTrackback = null;
}
};
mgr.doWhenFocusSettlesDown(r);
}
}
示例2: findProject
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public static AsyncResult<Project> findProject() {
final AsyncResult<Project> project = new AsyncResult<Project>();
final IdeFocusManager fm = IdeFocusManager.getGlobalInstance();
fm.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
Component parent = UIUtil.findUltimateParent(fm.getFocusOwner());
if (parent instanceof IdeFrame) {
IdeFrame frame = (IdeFrame)parent;
if (frame.getProject() != null) {
project.setDone(frame.getProject());
return;
}
}
project.setRejected();
}
});
return project;
}
示例3: updateActions
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
private void updateActions(boolean now, final boolean transparentOnly, final boolean forced) {
final Runnable updateRunnable = new MyUpdateRunnable(this, transparentOnly, forced);
final Application app = ApplicationManager.getApplication();
if (now || app.isUnitTestMode()) {
updateRunnable.run();
}
else {
final IdeFocusManager fm = IdeFocusManager.getInstance(null);
if (!app.isHeadlessEnvironment()) {
if (app.isDispatchThread() && myComponent.isShowing()) {
fm.doWhenFocusSettlesDown(updateRunnable);
}
else {
UiNotifyConnector.doWhenFirstShown(myComponent, new Runnable() {
@Override
public void run() {
fm.doWhenFocusSettlesDown(updateRunnable);
}
});
}
}
}
}
示例4: focusTable
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public void focusTable() {
final Project project = myModel.getProject();
final IdeFocusManager focusManager = project == null || project.isDefault()
? IdeFocusManager.getGlobalInstance() : IdeFocusManager.getInstance(project);
focusManager.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
focusManager.requestFocus(myTable, true);
}
});
}
示例5: focus
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
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);
}
});
}
示例6: getActiveSplitters
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@NotNull
private AsyncResult<EditorsSplitters> getActiveSplitters(boolean syncUsage) {
final boolean async = Registry.is("ide.windowSystem.asyncSplitters") && !syncUsage;
final AsyncResult<EditorsSplitters> result = new AsyncResult<EditorsSplitters>();
final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
Runnable run = new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) {
result.setRejected();
return;
}
Component focusOwner = fm.getFocusOwner();
if (focusOwner == null && !async) {
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
}
if (focusOwner == null && !async) {
focusOwner = fm.getLastFocusedFor(fm.getLastFocusedFrame());
}
DockContainer container = myDockManager.getContainerFor(focusOwner);
if (container == null && !async) {
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
container = myDockManager.getContainerFor(focusOwner);
}
if (container instanceof DockableEditorTabbedContainer) {
result.setDone(((DockableEditorTabbedContainer)container).getSplitters());
}
else {
result.setDone(getMainSplitters());
}
}
};
if (async) {
fm.doWhenFocusSettlesDown(run);
}
else {
UIUtil.invokeLaterIfNeeded(run);
}
return result;
}
示例7: _execute
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@Override
protected ActionCallback _execute(PlaybackContext context) {
String[] args = getText().substring(PREFIX.length()).trim().split(" ");
String syntaxText = "Syntax error, expected: " + PREFIX + " " + ON + "|" + OFF + " actionName";
if (args.length != 2) {
context.error(syntaxText, getLine());
return ActionCallback.REJECTED;
}
final boolean on;
if (ON.equalsIgnoreCase(args[0])) {
on = true;
} else if (OFF.equalsIgnoreCase(args[0])) {
on = false;
} else {
context.error(syntaxText, getLine());
return ActionCallback.REJECTED;
}
String actionId = args[1];
final AnAction action = ActionManager.getInstance().getAction(actionId);
if (action == null) {
context.error("Unknown action id=" + actionId, getLine());
return ActionCallback.REJECTED;
}
if (!(action instanceof ToggleAction)) {
context.error("Action is not a toggle action id=" + actionId, getLine());
return ActionCallback.REJECTED;
}
final InputEvent inputEvent = ActionCommand.getInputEvent(actionId);
final ActionCallback result = new ActionCallback();
context.getRobot().delay(Registry.intValue("actionSystem.playback.delay"));
IdeFocusManager fm = IdeFocusManager.getGlobalInstance();
fm.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
final Presentation presentation = (Presentation)action.getTemplatePresentation().clone();
AnActionEvent event =
new AnActionEvent(inputEvent, DataManager.getInstance()
.getDataContext(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()), ActionPlaces.UNKNOWN,
presentation, ActionManager.getInstance(), 0);
ActionUtil.performDumbAwareUpdate(action, event, false);
Boolean state = (Boolean)event.getPresentation().getClientProperty(ToggleAction.SELECTED_PROPERTY);
if (state.booleanValue() != on) {
ActionManager.getInstance().tryToExecute(action, inputEvent, null, ActionPlaces.UNKNOWN, true).doWhenProcessed(result.createSetDoneRunnable());
}
else {
result.setDone();
}
}
});
return result;
}
示例8: contextMenu
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public static AsyncResult<String> contextMenu(final PlaybackContext context, final String path) {
final AsyncResult<String> result = new AsyncResult<String>();
final IdeFocusManager fm = IdeFocusManager.getGlobalInstance();
fm.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
Component owner = fm.getFocusOwner();
if (owner == null) {
result.setRejected("No component focused");
return;
}
ActionManager am = ActionManager.getInstance();
AnAction showPopupMenu = am.getAction("ShowPopupMenu");
if (showPopupMenu == null) {
result.setRejected("Cannot find action: ShowPopupMenu");
return;
}
am.tryToExecute(showPopupMenu, new MouseEvent(owner, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, true), null,
null, false).doWhenDone(
new Runnable() {
@Override
public void run() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MenuElement[] selectedPath = MenuSelectionManager.defaultManager().getSelectedPath();
if (selectedPath.length == 0) {
result.setRejected("Failed to find active popup menu");
return;
}
selectNext(context, path.split("\\|"), 0, selectedPath[0].getSubElements(), result);
}
});
}
}).doWhenRejected(new Runnable() {
@Override
public void run() {
result.setRejected("Cannot invoke popup menu from the ShowPopupMenu action, action call rejected");
}
});
}
});
return result;
}