ExpirableRunnable (@NotNull Project project, @NotNull Runnable runnable) { return new ExpirableRunnable() { @Override public boolean isExpired() { return project.isDisposed(); } @Override public void run() { runnable.run(); } }; }