boolean (final Object object) { if (object instanceof Project) { return !((Project)object).isDisposed(); } if (object instanceof Module) { return !((Module)object).isDisposed(); } if (object instanceof PsiElement) { return ReadAction.compute(() -> ((PsiElement)object).isValid()).booleanValue(); } return object != null; }