private static boolean isAllDirectories(PsiElement @Nullable [] elements) {
    if (elements == null || elements.length == 0) return false;
    for (PsiElement element : elements) {
      if (!(element instanceof PsiDirectory) || FileIndexFacade.getInstance(element.getProject())
        .isInLibraryClasses(((PsiDirectory)element).getVirtualFile())) {
        return false;
      }
    }
    return true;
  }
private static boolean isAllDirectories(PsiElement @Nullable [] elements)