本文整理汇总了Java中com.intellij.openapi.util.ActionCallback类的典型用法代码示例。如果您正苦于以下问题:Java ActionCallback类的具体用法?Java ActionCallback怎么用?Java ActionCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionCallback类属于com.intellij.openapi.util包,在下文中一共展示了ActionCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectLater
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
private void selectLater(final ActionCallback callback, final K key) {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
if (!myDisposed) {
final UI ui = prepare(key);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (!myDisposed) {
select(callback, key, ui);
}
else callback.setRejected();
}
}, ModalityState.any());
}
else callback.setRejected();
}
});
}
示例2: type
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
protected ActionCallback type(final PlaybackContext context, final String text) {
final ActionCallback result = new ActionCallback();
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
TypingTarget typingTarget = findTarget(context);
if (typingTarget != null) {
typingTarget.type(text).doWhenDone(result.createSetDoneRunnable()).doWhenRejected(new Runnable() {
public void run() {
typeByRobot(context.getRobot(), text).notify(result);
}
});
} else {
typeByRobot(context.getRobot(), text).notify(result);
}
}
});
return result;
}
示例3: createUpdater
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
@Override
protected final AbstractTreeUpdater createUpdater() {
return new AbstractTreeUpdater(this) {
@Override
protected ActionCallback beforeUpdate(final TreeUpdatePass pass) {
if (!myDirtyFileSet.isEmpty()) { // suppress redundant cache validations
final AsyncResult callback = new AsyncResult();
DumbService.getInstance(myProject).runWhenSmart(new Runnable() {
@Override
public void run() {
try {
validateCache();
getTodoTreeStructure().validateCache();
}
finally {
callback.setDone();
}
}
});
return callback;
}
return ActionCallback.DONE;
}
};
}
示例4: _execute
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
@Override
protected ActionCallback _execute(PlaybackContext context) {
final String[] keyValue = getText().substring(PREFIX.length()).trim().split("=");
if (keyValue.length != 2) {
context.error("Expected expresstion: " + PREFIX + " key=value", getLine());
return ActionCallback.REJECTED;
}
final String key = keyValue[0];
final String value = keyValue[1];
context.storeRegistryValue(key);
Registry.get(key).setValue(value);
return ActionCallback.DONE;
}
示例5: tweakFrameFullScreen
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
private static ActionCallback tweakFrameFullScreen(Project project, boolean inPresentation) {
Window window = IdeFrameImpl.getActiveFrame();
if (window instanceof IdeFrameImpl) {
IdeFrameImpl frame = (IdeFrameImpl)window;
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
if (inPresentation) {
propertiesComponent.setValue("full.screen.before.presentation.mode", String.valueOf(frame.isInFullScreen()));
return frame.toggleFullScreen(true);
}
else {
if (frame.isInFullScreen()) {
final String value = propertiesComponent.getValue("full.screen.before.presentation.mode");
return frame.toggleFullScreen("true".equalsIgnoreCase(value));
}
}
}
return ActionCallback.DONE;
}
示例6: 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;
}
示例7: RequestFocusInEditorComponentCmd
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
public RequestFocusInEditorComponentCmd(@NotNull final EditorsSplitters splitters, IdeFocusManager
focusManager, final Runnable finishCallBack, boolean forced){
super(finishCallBack);
boolean shouldLogFocuses = Registry.is("ide.log.focuses");
if (shouldLogFocuses) {
LOG.info(new Exception());
}
myComponent = null;
final EditorWindow window = splitters.getCurrentWindow();
if (window != null) {
final EditorWithProviderComposite editor = window.getSelectedEditor();
if (editor != null) {
myComponent = editor.getPreferredFocusedComponent();
}
}
myForced = forced;
myFocusManager = focusManager;
myDoneCallback = new ActionCallback();
myTimestamp = myFocusManager.getTimestamp(true);
}
示例8: refilterNow
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
@Override
protected ActionCallback refilterNow(Object preferredSelection, boolean adjustSelection) {
final List<Object> toRestore = new ArrayList<Object>();
if (myFilter.myContext.isHoldingFilter() && !myWasHoldingFilter && myToExpandOnResetFilter == null) {
myToExpandOnResetFilter = myBuilder.getUi().getExpandedElements();
}
else if (!myFilter.myContext.isHoldingFilter() && myWasHoldingFilter && myToExpandOnResetFilter != null) {
toRestore.addAll(myToExpandOnResetFilter);
myToExpandOnResetFilter = null;
}
myWasHoldingFilter = myFilter.myContext.isHoldingFilter();
ActionCallback result = super.refilterNow(preferredSelection, adjustSelection);
myRefilteringNow = true;
return result.doWhenDone(new Runnable() {
public void run() {
myRefilteringNow = false;
if (!myFilter.myContext.isHoldingFilter() && getSelectedElements().isEmpty()) {
restoreExpandedState(toRestore);
}
}
});
}
示例9: 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);
}
}
}
示例10: updateCourseList
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
private static ActionCallback updateCourseList() {
ActionCallback callback = new ActionCallback();
ApplicationManager.getApplication().executeOnPooledThread(() -> {
final List<Course> courses = EduStepicConnector.getCourses(null);
StudySettings.getInstance().setLastTimeChecked(System.currentTimeMillis());
if (!courses.isEmpty()) {
List<Course> updated = new ArrayList<>();
for (Course course : courses) {
if (course instanceof RemoteCourse && ((RemoteCourse)course).getUpdateDate().
after(new Date(StudySettings.getInstance().getLastTimeChecked()))) {
updated.add(course);
}
}
if (updated.isEmpty()) return;
final String message;
final String title;
if (updated.size() == 1) {
message = updated.get(0).getName();
title = "New course available";
}
else {
title = "New courses available";
message = StringUtil.join(updated, Course::getName, ", ");
}
final Notification notification = new Notification("New.course", title, message, NotificationType.INFORMATION);
notification.notify(null);
}
});
return callback;
}
示例11: asyncCommitDocuments
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
@NotNull
public static ActionCallback asyncCommitDocuments(@NotNull Project project) {
if (project.isDisposed()) return ActionCallback.DONE;
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
if (!documentManager.hasUncommitedDocuments()) {
return ActionCallback.DONE;
}
final ActionCallback callback = new ActionCallback();
documentManager.performWhenAllCommitted(callback.createSetDoneRunnable());
return callback;
}
示例12: restoreLastUiState
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
public ActionCallback restoreLastUiState() {
final ActionCallback result = new ActionCallback(myPlaceInGrid2Cell.values().size());
for (final GridCellImpl cell : myPlaceInGrid2Cell.values()) {
cell.restoreLastUiState().notifyWhenDone(result);
}
return result;
}
示例13: updateFromRootCB
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
@Override
@NotNull
public ActionCallback updateFromRootCB() {
getStructure().rootsChanged();
if (isDisposed()) return ActionCallback.DONE;
getUpdater().cancelAllRequests();
return super.updateFromRootCB();
}
示例14: _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;
}
示例15: selectOrderEntry
import com.intellij.openapi.util.ActionCallback; //导入依赖的package包/类
public ActionCallback selectOrderEntry(@NotNull final Module module, @Nullable final OrderEntry orderEntry) {
for (final ModuleStructureExtension extension : ModuleStructureExtension.EP_NAME.getExtensions()) {
final ActionCallback callback = extension.selectOrderEntry(module, orderEntry);
if (callback != null) {
return callback;
}
}
Place p = new Place();
p.putPath(ProjectStructureConfigurable.CATEGORY, this);
Runnable r = null;
final MasterDetailsComponent.MyNode node = findModuleNode(module);
if (node != null) {
p.putPath(TREE_OBJECT, module);
p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
r = new Runnable() {
@Override
public void run() {
if (orderEntry != null) {
ModuleEditor moduleEditor = ((ModuleConfigurable)node.getConfigurable()).getModuleEditor();
ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
if (editor instanceof ClasspathEditor) {
((ClasspathEditor)editor).selectOrderEntry(orderEntry);
}
}
}
};
}
final ActionCallback result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
return r != null ? result.doWhenDone(r) : result;
}