Example #1
0
 private boolean hasLibraries() {
   final Predicate<Library> condition =
       LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel());
   for (LibraryTable table :
       ChooseLibrariesFromTablesDialog.getLibraryTables(myClasspathPanel.getProject(), true)) {
     final LibrariesModifiableModel model = myContext.myLevel2Providers.get(table.getTableLevel());
     if (model != null) {
       for (Library library : model.getLibraries()) {
         if (condition.apply(library)) {
           return true;
         }
       }
     }
   }
   return false;
 }
 private List<Node> getAllAncestors(Node a, Predicate<Node> stop) {
   Set<Node> all = new LinkedHashSet<Node>();
   Queue<Node> queue = new ArrayDeque<Node>();
   queue.add(a);
   while (!queue.isEmpty()) {
     Node aNode = queue.remove();
     all.add(aNode);
     if (stop.apply(aNode)) {
       return new ArrayList<Node>(all);
     }
     for (Edge edge : aNode.getDownEdges()) {
       queue.add(edge.getDownNode());
     }
   }
   return new ArrayList<Node>(all);
 }