void (Runnable onClose) { synchronized (myMessageViewLock) { if (myErrorTreeView != null) { Disposer.register(myErrorTreeView, new Disposable() { @Override public void dispose() { onClose.run(); } }); return; } } onClose.run(); }