private static boolean isValidSearchScope(@NotNull AnActionEvent e) {
    final PsiElement[] elements = e.getData(PlatformCoreDataKeys.PSI_ELEMENT_ARRAY);
    if (elements != null && elements.length == 1 && elements[0] instanceof PsiDirectoryContainer) {
      return true;
    }
    final VirtualFile[] virtualFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
    if (virtualFiles == null) {
      return false;
    }
    return virtualFiles.length > 1 || virtualFiles.length == 1 && virtualFiles[0].isDirectory();
  }
private static boolean isValidSearchScope(@NotNull AnActionEvent e)