1 19 package org.netbeans.modules.subversion.ui.history; 20 21 import org.openide.windows.TopComponent; 22 import org.openide.util.NbBundle; 23 import org.openide.util.HelpCtx; 24 import org.netbeans.modules.subversion.util.Context; 25 import org.netbeans.modules.subversion.ui.diff.DiffSetupSource; 26 import org.tigris.subversion.svnclientadapter.SVNUrl; 27 28 import java.util.*; 29 import java.io.File ; 30 import java.awt.BorderLayout ; 31 32 35 public class SearchHistoryTopComponent extends TopComponent implements DiffSetupSource { 36 37 private SearchHistoryPanel shp; 38 39 public SearchHistoryTopComponent() { 40 getAccessibleContext().setAccessibleName(NbBundle.getMessage(SearchHistoryTopComponent.class, "ACSN_SearchHistoryT_Top_Component")); getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SearchHistoryTopComponent.class, "ACSD_SearchHistoryT_Top_Component")); } 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 this(); 50 initComponents(context.getRootFiles(), commitMessage, username, from, to); 51 } 52 53 public SearchHistoryTopComponent(SVNUrl repositoryUrl, File localRoot, long revision) { 54 this(); 55 initComponents(repositoryUrl, localRoot, revision); 56 } 57 58 public void search() { 59 shp.executeSearch(); 60 } 61 62 private void initComponents(SVNUrl repositoryUrl, File localRoot, long revision) { 63 setLayout(new BorderLayout ()); 64 SearchCriteriaPanel scp = new SearchCriteriaPanel(repositoryUrl); 65 scp.setFrom(Long.toString(revision)); 66 scp.setTo(Long.toString(revision)); 67 shp = new SearchHistoryPanel(repositoryUrl, localRoot, scp); 68 add(shp); 69 } 70 71 private void initComponents(File [] roots, String commitMessage, String username, Date from, Date to) { 72 setLayout(new BorderLayout ()); 73 SearchCriteriaPanel scp = new SearchCriteriaPanel(roots); 74 scp.setCommitMessage(commitMessage); 75 scp.setUsername(username); 76 if (from != null) scp.setFrom(SearchExecutor.simpleDateFormat.format(from)); 77 if (to != null) scp.setTo(SearchExecutor.simpleDateFormat.format(to)); 78 shp = new SearchHistoryPanel(roots, scp); 79 add(shp); 80 } 81 82 public int getPersistenceType(){ 83 return TopComponent.PERSISTENCE_NEVER; 84 } 85 86 protected void componentClosed() { 87 super.componentClosed(); 89 } 90 91 protected String preferredID(){ 92 return "Svn.SearchHistoryTopComponent"; } 94 95 public HelpCtx getHelpCtx() { 96 return new HelpCtx(getClass()); 97 } 98 99 public Collection getSetups() { 100 return shp.getSetups(); 101 } 102 103 public String getSetupDisplayName() { 104 return getDisplayName(); 105 } 106 } 107 | Popular Tags |