void (@NotNull Registry registry) { Validator<PsiElement> psiValidator = (data, dataId, source) -> data.isValid(); registry.register(CommonDataKeys.PSI_FILE, psiValidator); registry.register(CommonDataKeys.PSI_ELEMENT, psiValidator); registry.register(LangDataKeys.PSI_ELEMENT_ARRAY, arrayValidator(psiValidator)); Validator<Module> moduleValidator = (data, dataId, source) -> !data.isDisposed(); registry.register(PlatformCoreDataKeys.MODULE, moduleValidator); registry.register(LangDataKeys.MODULE_CONTEXT, moduleValidator); registry.register(LangDataKeys.MODULE_CONTEXT_ARRAY, arrayValidator(moduleValidator)); }