1 19 20 package org.netbeans.modules.xml.xam.ui.search; 21 22 import org.netbeans.modules.xml.xam.Component; 23 import org.netbeans.modules.xml.xam.ui.category.Category; 24 import org.netbeans.modules.xml.xam.ui.category.CategoryPane; 25 import org.openide.util.Lookup; 26 27 32 public class DefaultSearchControlPanel extends SearchControlPanel { 33 34 private static final long serialVersionUID = 1L; 35 36 private transient Lookup.Template providerTemplate; 37 38 private transient CategoryPane categoryPane; 39 40 45 public DefaultSearchControlPanel(CategoryPane categoryPane) { 46 this.categoryPane = categoryPane; 47 providerTemplate = new Lookup.Template(SearchProvider.class); 48 } 49 50 public void addNotify() { 51 super.addNotify(); 52 Category cat = categoryPane.getCategory(); 53 Lookup.Result result = cat.getLookup().lookup(providerTemplate); 54 setProviders(result.allInstances()); 55 } 56 57 protected void showSearchResult(Object result) { 58 if (result instanceof Component) { 59 Component comp = (Component) result; 60 categoryPane.getCategory().showComponent(comp); 61 } 62 } 63 64 69 public void updateSearchProviders() { 70 Category cat = categoryPane.getCategory(); 71 Lookup.Result result = cat.getLookup().lookup(providerTemplate); 72 setProviders(result.allInstances()); 73 } 74 } 75 | Popular Tags |