use of com.intellij.openapi.util.ActionCallback in project android by JetBrains.
the class DependenciesTreeBuilder method reset.
public void reset(@Nullable Runnable onDone) {
AbstractTreeStructure treeStructure = getTreeStructure();
if (treeStructure instanceof DependenciesTreeStructure) {
((DependenciesTreeStructure) treeStructure).reset();
ActionCallback callback = queueUpdate();
if (onDone != null) {
callback.doWhenDone(onDone);
}
}
}
use of com.intellij.openapi.util.ActionCallback in project intellij-plugins by JetBrains.
the class Client method updatePropertyOrStyle.
public ActionCallback updatePropertyOrStyle(int documentId, int componentId, Consumer<AmfOutputStream> streamConsumer) {
final ActionCallback callback = new ActionCallback("updatePropertyOrStyle");
boolean hasError = true;
try {
beginMessage(ClientMethod.updatePropertyOrStyle, callback);
out.writeUInt29(documentId);
out.writeUInt29(componentId);
streamConsumer.consume(out);
hasError = false;
} finally {
finalizeMessageAndFlush(hasError, callback);
}
return callback;
}
use of com.intellij.openapi.util.ActionCallback in project intellij-plugins by JetBrains.
the class Client method renderDocument.
/**
* final, full render document - responsible for handle problemsHolder and assetCounter - you must not do it
*/
public AsyncResult<DocumentInfo> renderDocument(Module module, XmlFile psiFile, ProblemsHolder problemsHolder) {
VirtualFile virtualFile = psiFile.getVirtualFile();
final int factoryId = registerDocumentFactoryIfNeed(module, psiFile, virtualFile, false, problemsHolder);
final AsyncResult<DocumentInfo> result = new AsyncResult<>();
if (factoryId == -1) {
result.setRejected();
return result;
}
FlexLibrarySet flexLibrarySet = registeredModules.getInfo(module).getFlexLibrarySet();
if (flexLibrarySet != null) {
fillAssetClassPoolIfNeed(flexLibrarySet);
}
if (!problemsHolder.isEmpty()) {
DocumentProblemManager.getInstance().report(module.getProject(), problemsHolder);
}
final ActionCallback callback = new ActionCallback("renderDocument");
boolean hasError = true;
try {
beginMessage(ClientMethod.renderDocument, callback, result, () -> result.setDone(DocumentFactoryManager.getInstance().getInfo(factoryId)));
out.writeShort(factoryId);
hasError = false;
} finally {
finalizeMessageAndFlush(hasError);
}
return result;
}
use of com.intellij.openapi.util.ActionCallback in project intellij-plugins by JetBrains.
the class TestClient method test.
public ActionCallback test(@Nullable Module module, int documentId, String method, int classId) throws IOException {
// method called only and only after openDocument and shouldn't be any calls between
// in non-tests the same agreement, except must be flush after openDocument always
//blockOut.end();
ActionCallback callback = new ActionCallback("test");
out.write(CLASS);
out.write(SocketInputHandler.getInstance().addCallback(callback));
out.write(classId);
if (module == null) {
out.writeShort(-1);
} else {
writeId(module, out);
}
out.writeShort(documentId);
out.writeAmfUtf(method, false);
flush();
return callback;
}
use of com.intellij.openapi.util.ActionCallback in project intellij-community by JetBrains.
the class FrameWrapper method show.
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 = getPreferredFocusedComponent();
if (toFocus == null) {
toFocus = fm.getFocusTargetFor(myComponent);
}
if (toFocus != null) {
fm.requestFocus(toFocus, true).notify(myFocusedCallback);
} else {
myFocusedCallback.setRejected();
}
}
};
frame.addWindowListener(focusListener);
if (Registry.is("ide.perProjectModality")) {
frame.setAlwaysOnTop(true);
}
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 && myImage != null) {
// unwrap the image before setting as frame's icon
frame.setIconImage(ImageUtil.toBufferedImage(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);
}
}
Aggregations