1 19 20 package org.netbeans.modules.versioning.system.cvss.ui.history; 21 22 import org.openide.windows.TopComponent; 23 import org.openide.util.NbBundle; 24 import org.openide.util.HelpCtx; 25 import org.netbeans.modules.versioning.system.cvss.util.Context; 26 import org.netbeans.modules.versioning.system.cvss.ui.actions.diff.DiffSetupSource; 27 28 import java.awt.BorderLayout ; 29 import java.io.File ; 30 import java.util.*; 31 32 37 public class SearchHistoryTopComponent extends TopComponent implements DiffSetupSource { 38 39 private SearchHistoryPanel shp; 40 41 public SearchHistoryTopComponent() { 42 } 43 44 public SearchHistoryTopComponent(Context context) { 45 this(context, null, null, null, null); 46 } 47 48 public SearchHistoryTopComponent(Context context, String commitMessage, String username, Date from, Date to) { 49 initComponents(context.getRootFiles(), commitMessage, username, from, to); 50 getAccessibleContext().setAccessibleName(NbBundle.getMessage(SearchHistoryTopComponent.class, "ACSN_SearchHistoryT_Top_Component")); getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SearchHistoryTopComponent.class, "ACSD_SearchHistoryT_Top_Component")); } 53 54 public void search() { 55 shp.executeSearch(); 56 shp.setSearchCriteriaVisible(false); 57 } 58 59 private void initComponents(File [] roots, String commitMessage, String username, Date from, Date to) { 60 setLayout(new BorderLayout ()); 61 SearchCriteriaPanel scp = new SearchCriteriaPanel(roots); 62 scp.setCommitMessage(commitMessage); 63 scp.setUsername(username); 64 if (from != null) scp.setFrom(SearchExecutor.simpleDateFormat.format(from)); 65 if (to != null) scp.setTo(SearchExecutor.simpleDateFormat.format(to)); 66 shp = new SearchHistoryPanel(roots, scp); 67 add(shp); 68 } 69 70 public int getPersistenceType(){ 71 return TopComponent.PERSISTENCE_NEVER; 72 } 73 74 protected void componentClosed() { 75 super.componentClosed(); 77 } 78 79 protected String preferredID(){ 80 return "SearchHistoryTopComponent"; } 82 83 public HelpCtx getHelpCtx() { 84 return new HelpCtx(getClass()); 85 } 86 87 public Collection getSetups() { 88 return shp.getSetups(); 89 } 90 91 public String getSetupDisplayName() { 92 return getDisplayName(); 93 } 94 } 95 | Popular Tags |