本文整理汇总了Java中com.intellij.openapi.util.ActionCallback.setRejected方法的典型用法代码示例。如果您正苦于以下问题:Java ActionCallback.setRejected方法的具体用法?Java ActionCallback.setRejected怎么用?Java ActionCallback.setRejected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.ActionCallback
的用法示例。
在下文中一共展示了ActionCallback.setRejected方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeCodes
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback typeCodes(final PlaybackContext context, final Robot robot, final String codes) {
final ActionCallback result = new ActionCallback();
Runnable runnable = new Runnable() {
public void run() {
String[] pairs = codes.split(CODE_DELIMITER);
for (String eachPair : pairs) {
try {
String[] splits = eachPair.split(MODIFIER_DELIMITER);
Integer code = Integer.valueOf(splits[0]);
Integer modifier = Integer.valueOf(splits[1]);
type(robot, code.intValue(), modifier.intValue());
}
catch (NumberFormatException e) {
dumpError(context, "Invalid code: " + eachPair);
result.setRejected();
return;
}
}
result.setDone();
}
};
if (SwingUtilities.isEventDispatchThread()) {
ApplicationManager.getApplication().executeOnPooledThread(runnable);
} else {
runnable.run();
}
return result;
}
示例2: _restoreFocus
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback _restoreFocus() {
final List<FocusTrackback> stack = getCleanStack();
if (!stack.contains(this)) return ActionCallback.REJECTED;
Component toFocus = queryToFocus(stack, this, true);
final ActionCallback result = new ActionCallback();
if (toFocus != null) {
final Component ownerBySwing = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (ownerBySwing != null) {
final Window ownerBySwingWindow = SwingUtilities.getWindowAncestor(ownerBySwing);
if (ownerBySwingWindow != null && ownerBySwingWindow == SwingUtilities.getWindowAncestor(toFocus)) {
if (!UIUtil.isMeaninglessFocusOwner(ownerBySwing)) {
toFocus = ownerBySwing;
}
}
}
if (myParentWindow != null) {
final Window to = UIUtil.getWindow(toFocus);
if (to != null && UIUtil.findUltimateParent(to) == UIUtil.findUltimateParent(myParentWindow)) { // IDEADEV-34537
requestFocus(toFocus);
result.setDone();
}
} else {
requestFocus(toFocus);
result.setDone();
}
}
if (!result.isDone()) {
result.setRejected();
}
stack.remove(this);
dispose();
return result;
}
示例3: select
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private void select(ActionCallback callback, K key, UI ui) {
if (myKey != key) {
callback.setRejected();
}
else {
V value = myContent.get(key);
if (value == null && !myContent.containsKey(key)) {
value = createValue(key, ui);
}
for (Component component : getComponents()) {
component.setVisible(component == value);
}
callback.setDone();
}
}
示例4: requestFocus
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
@NotNull
private ActionCallback requestFocus(@NotNull final Component c) {
final ActionCallback result = new ActionCallback();
final Alarm checkerAlarm = new Alarm(result);
Runnable checker = new Runnable() {
final long startTime = System.currentTimeMillis();
@Override
public void run() {
if (System.currentTimeMillis() - startTime > 10000) {
result.setRejected();
return;
}
if (c.isShowing()) {
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
if (owner != null && owner == c) {
myManager.getFocusManager().requestFocus(new FocusCommand() {
@Override
@NotNull
public ActionCallback run() {
return ActionCallback.DONE;
}
}, myForced).doWhenProcessed(new Runnable() {
@Override
public void run() {
updateToolWindow(c);
}
}).notify(result);
}
else {
myManager.getFocusManager().requestFocus(new FocusCommand.ByComponent(c, myToolWindow.getComponent(), new Exception()), myForced)
.doWhenProcessed(new Runnable() {
@Override
public void run() {
updateToolWindow(c);
}
}).notify(result);
}
}
else {
checkerAlarm.addRequest(this, 100);
}
}
};
checkerAlarm.addRequest(checker, 0);
return result;
}
示例5: queueSelection
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
ActionCallback queueSelection(final Configurable configurable) {
if (myBuilder.isSelectionBeingAdjusted()) {
return ActionCallback.REJECTED;
}
final ActionCallback callback = new ActionCallback();
myQueuedConfigurable = configurable;
final Update update = new Update(this) {
public void run() {
if (configurable != myQueuedConfigurable) return;
if (configurable == null) {
myTree.getSelectionModel().clearSelection();
myFilter.myContext.fireSelected(null, OptionsTree.this);
}
else {
myBuilder.getReady(this).doWhenDone(new Runnable() {
@Override
public void run() {
if (configurable != myQueuedConfigurable) return;
final EditorNode editorNode = myConfigurable2Node.get(configurable);
FilteringTreeStructure.FilteringNode editorUiNode = myBuilder.getVisibleNodeFor(editorNode);
if (editorUiNode == null) return;
if (!myBuilder.getSelectedElements().contains(editorUiNode)) {
myBuilder.select(editorUiNode, new Runnable() {
public void run() {
fireSelected(configurable, callback);
}
});
} else {
myBuilder.scrollSelectionToVisible(new Runnable() {
public void run() {
fireSelected(configurable, callback);
}
}, false);
}
}
});
}
}
@Override
public void setRejected() {
super.setRejected();
callback.setRejected();
}
};
mySelection.queue(update);
return callback;
}
示例6: show
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
public void show(boolean restoreBounds) {
myFocusedCallback = new ActionCallback();
if (myProject != null) {
IdeFocusManager.getInstance(myProject).typeAheadUntil(myFocusedCallback);
}
final Window frame = getFrame();
if (myStatusBar != null) {
myStatusBar.install((IdeFrame)frame);
}
myFocusTrackback = new FocusTrackback(this, IdeFocusManager.findInstance().getFocusOwner(), true);
if (frame instanceof JFrame) {
((JFrame)frame).setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
} else {
((JDialog)frame).setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
final WindowAdapter focusListener = new WindowAdapter() {
public void windowOpened(WindowEvent e) {
IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
JComponent toFocus = myPreferedFocus;
if (toFocus == null) {
toFocus = fm.getFocusTargetFor(myComponent);
}
if (toFocus != null) {
fm.requestFocus(toFocus, true).notify(myFocusedCallback);
} else {
myFocusedCallback.setRejected();
}
}
};
frame.addWindowListener(focusListener);
Disposer.register(this, new Disposable() {
@Override
public void dispose() {
frame.removeWindowListener(focusListener);
}
});
if (myCloseOnEsc) addCloseOnEsc((RootPaneContainer)frame);
((RootPaneContainer)frame).getContentPane().add(myComponent, BorderLayout.CENTER);
if (frame instanceof JFrame) {
((JFrame)frame).setTitle(myTitle);
} else {
((JDialog)frame).setTitle(myTitle);
}
if (myImageWasChanged) {
frame.setIconImage(myImage);
}
else {
AppUIUtil.updateWindowIcon(myFrame);
}
if (restoreBounds) {
loadFrameState();
}
myFocusWatcher = new FocusWatcher() {
protected void focusLostImpl(final FocusEvent e) {
myFocusTrackback.consume();
}
};
myFocusWatcher.install(myComponent);
myShown = true;
frame.setVisible(true);
if (UIUtil.isUnderAlloyLookAndFeel() && frame instanceof JFrame) {
//please ask [kb] before remove it
((JFrame)frame).setMaximizedBounds(null);
}
}
示例7: perform
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
@Override
public ActionCallback perform(List<LibraryOrderEntry> orderEntriesContainingFile) {
final ActionCallback callback = new ActionCallback();
Task task = new Task.Backgroundable(myProject, "Downloading Sources", true) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
final byte[] bytes;
try {
LOG.info("Downloading sources JAR: " + myUrl);
indicator.checkCanceled();
bytes = HttpRequests.request(myUrl).readBytes(indicator);
}
catch (IOException e) {
LOG.warn(e);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
new Notification(myMessageGroupId,
"Downloading failed",
"Failed to download sources: " + myUrl,
NotificationType.ERROR)
.notify(getProject());
callback.setDone();
}
});
return;
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
AccessToken accessToken = WriteAction.start();
try {
storeFile(bytes);
}
finally {
accessToken.finish();
callback.setDone();
}
}
});
}
@Override
public void onCancel() {
callback.setRejected();
}
};
task.queue();
return callback;
}