public boolean canRepresent(@NotNull VirtualFile element, @NotNull PsiDirectory directory, @NotNull PsiDirectory owner, ViewSettings settings) {
    if (canRepresent(element, directory)) return true;
    if (settings == null) return false; // unexpected
    if (settings.isFlattenPackages() || !settings.isHideEmptyMiddlePackages()) {
      return false;
    }
    return !processParents(directory, owner, dir -> !element.equals(dir.getVirtualFile()));
  }
public boolean canRepresent(@NotNull VirtualFile element, @NotNull PsiDirectory directory, @NotNull PsiDirectory owner, ViewSettings settings)