boolean (Object element) { Project project = getValue(); if (project == element) return true; if (element instanceof PsiDirectory directory) { element = directory.getVirtualFile(); } if (element instanceof VirtualFile) { ProjectRootManager manager = project == null || project.isDisposed() ? null : ProjectRootManager.getInstance(project); if (manager != null) { return ArrayUtil.contains(element, manager.getContentSourceRoots()); } } return false; }