use of com.intellij.openapi.application.ApplicationAdapter in project intellij-community by JetBrains.
the class NoSwingUnderWriteAction method watchForEvents.
static void watchForEvents(Application application) {
AtomicBoolean reported = new AtomicBoolean();
IdeEventQueue.getInstance().addPostprocessor(e -> {
if (application.isWriteAccessAllowed() && reported.compareAndSet(false, true)) {
LOG.error("AWT events are not allowed inside write action: " + e);
}
return true;
}, application);
application.addApplicationListener(new ApplicationAdapter() {
@Override
public void afterWriteActionFinished(@NotNull Object action) {
reported.set(false);
}
});
}
Aggregations