@Nullable
 private PsiDirectory[] getSelectedDirectories() {
   if (myBuilder == null) return null;
   final Object[] selectedNodeElements = getSelectedNodeElements();
   if (selectedNodeElements.length != 1) return null;
   for (FavoriteNodeProvider nodeProvider :
       Extensions.getExtensions(FavoriteNodeProvider.EP_NAME, myProject)) {
     final PsiElement psiElement = nodeProvider.getPsiElement(selectedNodeElements[0]);
     if (psiElement instanceof PsiDirectory) {
       return new PsiDirectory[] {(PsiDirectory) psiElement};
     } else if (psiElement instanceof PsiDirectoryContainer) {
       final String moduleName = nodeProvider.getElementModuleName(selectedNodeElements[0]);
       GlobalSearchScope searchScope = GlobalSearchScope.projectScope(myProject);
       if (moduleName != null) {
         final Module module = ModuleManager.getInstance(myProject).findModuleByName(moduleName);
         if (module != null) {
           searchScope = GlobalSearchScope.moduleScope(module);
         }
       }
       return ((PsiDirectoryContainer) psiElement).getDirectories(searchScope);
     }
   }
   return selectedNodeElements[0] instanceof PsiDirectory
       ? new PsiDirectory[] {(PsiDirectory) selectedNodeElements[0]}
       : null;
 }
  @Nullable
  public static AbstractUrl createUrlByElement(Object element, final Project project) {
    if (element instanceof SmartPsiElementPointer)
      element = ((SmartPsiElementPointer) element).getElement();

    for (FavoriteNodeProvider nodeProvider :
        Extensions.getExtensions(FavoriteNodeProvider.EP_NAME, project)) {
      String url = nodeProvider.getElementUrl(element);
      if (url != null) {
        return new AbstractUrlFavoriteAdapter(
            url, nodeProvider.getElementModuleName(element), nodeProvider);
      }
    }

    for (AbstractUrl urlProvider : ourAbstractUrlProviders) {
      AbstractUrl url = urlProvider.createUrlByElement(element);
      if (url != null) return url;
    }
    return null;
  }