|                                                                                                              1
 19
 20  package org.netbeans.api.java.source.query;
 21
 22  import org.netbeans.api.java.source.query.SearchEntry;
 23  import org.netbeans.api.java.source.query.Query;
 24  import org.netbeans.api.java.source.query.SearchResult;
 25
 26  import com.sun.source.tree.Tree;
 27  import javax.lang.model.element.Element;
 28
 29
 32  public class Finder extends NodeScanner<Void
  ,Object  > { 33      private SearchResult results;
 34
 35      public SearchResult find(Tree root) {
 36          if (model == null)
 37              attach(env);
 38          results.clear();
 39      if(root!=null) root.accept(this, null);
 40      return results;
 41      }
 42
 43      public Finder(String
  title, Query owner) { 44          env = owner.getEnvironment();
 45          results = new SearchResult(null, title);
 46          results.attach(env);
 47      }
 48
 49      protected final void add(Tree t) {
 50          add(t, null, 0);
 51      }
 52
 53      protected final void add(Tree t, String
  msg) { 54      add(t, msg, 0);
 55      }
 56
 57      protected final void add(Tree t, String
  msg, int flags) { 58      add(currentSym, t, msg, flags);
 59      }
 60
 61      protected final void add(Element e, Tree t, String
  msg, int flags) { 62      results.add(new SearchEntry(null, e, t, model.getPos(t), msg, flags));
 63      }
 64  }
 65
                                                                                                                                                                                                             |                                                                       
 
 
 
 
 
                                                                                   Popular Tags                                                                                                                                                                                              |