本文整理汇总了Java中com.intellij.openapi.util.ActionCallback.setDone方法的典型用法代码示例。如果您正苦于以下问题:Java ActionCallback.setDone方法的具体用法?Java ActionCallback.setDone怎么用?Java ActionCallback.setDone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.ActionCallback
的用法示例。
在下文中一共展示了ActionCallback.setDone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applySwitch
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
public ActionCallback applySwitch() {
final ActionCallback result = new ActionCallback();
if (isSessionActive()) {
final boolean showSpots = mySession.isShowspots();
mySession.finish(false).doWhenDone(new Consumer<SwitchTarget>() {
@Override
public void consume(final SwitchTarget switchTarget) {
mySession = null;
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
tryToInitSessionFromFocus(switchTarget, showSpots).doWhenProcessed(result.createSetDoneRunnable());
}
});
}
});
}
else {
result.setDone();
}
return result;
}
示例2: processNextHang
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private void processNextHang(Object element, final ActionCallback callback) {
if (element == null || myUi.getSelectedElements().contains(element)) {
callback.setDone();
} else {
final Object nextElement = myUi.getTreeStructure().getParentElement(element);
if (nextElement == null) {
callback.setDone();
} else {
myUi.select(nextElement, new TreeRunnable("UpdaterTreeState.processNextHang") {
@Override
public void perform() {
processNextHang(nextElement, callback);
}
}, true);
}
}
}
示例3: perform
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
@Override
public ActionCallback perform(List<LibraryOrderEntry> orderEntriesContainingFile) {
ApplicationManager.getApplication().assertIsDispatchThread();
ActionCallback callback = new ActionCallback();
callback.setDone();
if (!mySrcFile.isValid()) return callback;
if (myLibrary != getLibraryFromOrderEntriesList(orderEntriesContainingFile)) return callback;
AccessToken accessToken = WriteAction.start();
try {
addSourceFile(mySrcFile, myLibrary);
}
finally {
accessToken.finish();
}
return callback;
}
示例4: processHangByParent
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback processHangByParent(Set<Object> elements) {
if (elements.isEmpty()) return ActionCallback.DONE;
ActionCallback result = new ActionCallback(elements.size());
for (Object hangElement : elements) {
if (!myAdjustmentCause2Adjustment.containsKey(hangElement)) {
processHangByParent(hangElement).notify(result);
}
else {
result.setDone();
}
}
return result;
}
示例5: 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;
}
示例6: _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;
}
示例7: 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();
}
}
示例8: restoreLastUiState
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
public ActionCallback restoreLastUiState() {
final ActionCallback result = new ActionCallback();
restoreProportions();
Content[] contents = getContents();
int window = 0;
for (Content each : contents) {
final View view = myContainer.getStateFor(each);
if (view.isMinimizedInGrid()) {
minimize(each);
}
window = view.getWindow();
}
final Tab tab = myContainer.getTab();
final boolean detached = (tab != null && tab.isDetached(myPlaceInGrid)) || window != myContext.getWindow();
if (detached && contents.length > 0) {
if (tab != null) {
tab.setDetached(myPlaceInGrid, false);
}
myContext.detachTo(window, this).notifyWhenDone(result);
}
else {
result.setDone();
}
return result;
}
示例9: select
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
public static ActionCallback select(@NotNull Project project,
final Object toSelect,
@Nullable final String viewId,
@Nullable final String subviewId,
final VirtualFile virtualFile,
final boolean requestFocus) {
final ActionCallback result = new ActionCallback();
ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
final ToolWindow favoritesToolWindow = windowManager.getToolWindow(ToolWindowId.FAVORITES_VIEW);
if (favoritesToolWindow != null) {
final FavoritesTreeViewPanel panel = UIUtil.findComponentOfType(favoritesToolWindow.getComponent(), FavoritesTreeViewPanel.class);
if (panel != null) {
final Runnable runnable = new Runnable() {
@Override
public void run() {
panel.selectElement(toSelect, virtualFile, requestFocus);
result.setDone();
}
};
if (requestFocus) {
favoritesToolWindow.activate(runnable, false);
}
else {
favoritesToolWindow.show(runnable);
}
}
}
return result;
}
示例10: updateFromRoot
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
@NotNull
@Override
public final ActionCallback updateFromRoot(boolean restoreExpandedPaths) {
final ArrayList<Object> pathsToExpand = new ArrayList<Object>();
final ArrayList<Object> selectionPaths = new ArrayList<Object>();
Runnable afterUpdate;
final ActionCallback cb = new ActionCallback();
if (restoreExpandedPaths) {
TreeBuilderUtil.storePaths(getTreeBuilder(), (DefaultMutableTreeNode)myTree.getModel().getRoot(), pathsToExpand, selectionPaths, true);
afterUpdate = new Runnable() {
@Override
public void run() {
if (myTree != null && getTreeBuilder() != null && !getTreeBuilder().isDisposed()) {
myTree.setSelectionPaths(new TreePath[0]);
TreeBuilderUtil.restorePaths(getTreeBuilder(), pathsToExpand, selectionPaths, true);
}
cb.setDone();
}
};
}
else {
afterUpdate = cb.createSetDoneRunnable();
}
if (getTreeBuilder() != null) {
getTreeBuilder().addSubtreeToUpdate(getTreeBuilder().getRootNode(), afterUpdate);
}
//myTreeBuilder.updateFromRoot();
return cb;
}
示例11: refilterNow
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
protected ActionCallback refilterNow(final Object preferredSelection, final boolean adjustSelection) {
final ActionCallback selectionDone = new ActionCallback();
getFilteredStructure().refilter();
getUi().updateSubtree(getRootNode(), false);
final Runnable selectionRunnable = new Runnable() {
@Override
public void run() {
revalidateTree();
Object toSelect = preferredSelection != null ? preferredSelection : myLastSuccessfulSelect;
if (adjustSelection && toSelect != null) {
final FilteringTreeStructure.FilteringNode nodeToSelect = getFilteredStructure().getVisibleNodeFor(toSelect);
if (nodeToSelect != null) {
select(nodeToSelect, new Runnable() {
@Override
public void run() {
if (getSelectedElements().contains(nodeToSelect)) {
myLastSuccessfulSelect = getOriginalNode(nodeToSelect);
}
selectionDone.setDone();
}
});
}
else {
TreeUtil.ensureSelection(myTree);
selectionDone.setDone();
}
}
else {
selectionDone.setDone();
}
}
};
if (!ApplicationManager.getApplication().isUnitTestMode()) {
queueUpdate().doWhenProcessed(selectionRunnable);
} else {
selectionRunnable.run();
}
final ActionCallback result = new ActionCallback();
selectionDone.doWhenDone(new Runnable() {
@Override
public void run() {
if (!ApplicationManager.getApplication().isUnitTestMode()) {
scrollSelectionToVisible(new Runnable() {
@Override
public void run() {
getReady(this).notify(result);
}
}, false);
} else {
result.setDone();
}
}
}).notifyWhenRejected(result);
return result;
}
示例12: processAjusted
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback processAjusted(final Map<Object, Condition> adjusted, final Set<Object> originallySelected) {
final ActionCallback result = new ActionCallback();
final Set<Object> allSelected = myUi.getSelectedElements();
Set<Object> toSelect = new HashSet<Object>();
for (Map.Entry<Object, Condition> entry : adjusted.entrySet()) {
if (entry.getValue().value(entry.getKey())) continue;
for (final Object eachSelected : allSelected) {
if (isParentOrSame(entry.getKey(), eachSelected)) continue;
toSelect.add(entry.getKey());
}
if (allSelected.isEmpty()) {
toSelect.add(entry.getKey());
}
}
final Object[] newSelection = ArrayUtil.toObjectArray(toSelect);
if (newSelection.length > 0) {
myUi._select(newSelection, new TreeRunnable("UpdaterTreeState.processAjusted") {
@Override
public void perform() {
final Set<Object> hangByParent = new HashSet<Object> ();
processUnsuccessfulSelections(newSelection, new Function<Object, Object>() {
@Override
public Object fun(final Object o) {
if (myUi.isInStructure(o) && !adjusted.get(o).value(o)) {
hangByParent.add(o);
} else {
addAdjustedSelection(o, adjusted.get(o), null);
}
return null;
}
}, originallySelected);
processHangByParent(hangByParent).notify(result);
}
}, false, true, true);
} else {
result.setDone();
}
return result;
}
示例13: processSelected
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback processSelected(final Configurable configurable, final Configurable oldConfigurable) {
if (isShowing(configurable)) return ActionCallback.DONE;
final ActionCallback result = new ActionCallback();
if (configurable == null) {
myOwnDetails.setContent(null);
myFilter.updateSpotlight(true);
checkModified(oldConfigurable);
result.setDone();
} else {
getUiFor(configurable).doWhenDone(new EdtRunnable() {
@Override
public void runEdt() {
if (myDisposed) return;
final Configurable current = getContext().getCurrentConfigurable();
if (current != configurable) {
result.setRejected();
return;
}
myHistory.pushQueryPlace();
updateDetails();
myOwnDetails.setContent(myContentWrapper);
myOwnDetails.setBannerMinHeight(mySearchWrapper.getHeight());
myOwnDetails.setText(getBannerText(configurable));
if (myTreeView != null) {
myOwnDetails.forProject(myTreeView.findConfigurableProject(configurable));
}
else if (Registry.is("ide.new.settings.dialog")) {
myOwnDetails.forProject(myTree.getConfigurableProject(configurable));
}
final ConfigurableContent content = myConfigurable2Content.get(current);
content.setText(getBannerText(configurable));
content.setBannerActions(new Action[] {new ResetAction(configurable)});
content.updateBannerActions();
myLoadingDecorator.stopLoading();
myFilter.updateSpotlight(false);
checkModified(oldConfigurable);
checkModified(configurable);
FilteringTreeBuilder builder = myTreeView != null ? myTreeView.myBuilder : myTree.myBuilder;
if (builder.getSelectedElements().size() == 0) {
select(configurable).notify(result);
} else {
result.setDone();
}
}
});
}
return result;
}
示例14: getUiFor
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback getUiFor(final Configurable configurable) {
assertIsDispatchThread();
if (myDisposed) {
return ActionCallback.REJECTED;
}
final ActionCallback result = new ActionCallback();
if (!myConfigurable2Content.containsKey(configurable)) {
final ActionCallback readyCallback = myConfigurable2LoadCallback.get(configurable);
if (readyCallback != null) {
return readyCallback;
}
myConfigurable2LoadCallback.put(configurable, result);
myLoadingDecorator.startLoading(false);
final Application app = ApplicationManager.getApplication();
Runnable action = new Runnable() {
@Override
public void run() {
app.runReadAction(new Runnable() {
@Override
public void run() {
((ApplicationEx)app).runEdtSafeAction(new Runnable() {
@Override
public void run() {
if (myFilter.myProject.isDisposed()) {
result.setRejected();
}
else {
initConfigurable(configurable).notifyWhenDone(result);
}
}
});
}
});
}
};
if (app.isUnitTestMode()) {
action.run();
}
else {
app.executeOnPooledThread(action);
}
}
else {
result.setDone();
}
return result;
}
示例15: typeByRobot
import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback typeByRobot(final Robot robot, final String text) {
final ActionCallback result = new ActionCallback();
Runnable typeRunnable = new Runnable() {
public void run() {
for (int i = 0; i < text.length(); i++) {
final char each = text.charAt(i);
if ('\\' == each && i + 1 < text.length()) {
final char next = text.charAt(i + 1);
boolean processed = true;
switch (next) {
case 'n':
type(robot, KeyEvent.VK_ENTER, 0);
break;
case 't':
type(robot, KeyEvent.VK_TAB, 0);
break;
case 'r':
type(robot, KeyEvent.VK_ENTER, 0);
break;
default:
processed = false;
}
if (processed) {
i++;
continue;
}
}
type(robot, get(each));
}
result.setDone();
}
};
if (SwingUtilities.isEventDispatchThread()) {
ApplicationManager.getApplication().executeOnPooledThread(typeRunnable);
} else {
typeRunnable.run();
}
return result;
}