Java Code Examples for org.tigris.subversion.svnclientadapter.SVNRevision#DateSpec
The following examples show how to use
org.tigris.subversion.svnclientadapter.SVNRevision#DateSpec .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SvnSearch.java From netbeans with Apache License 2.0 | 5 votes |
private SVNRevision getRevisionFrom() { String value = panel.dateFromTextField.getText().trim(); if(value.equals("")) { return new SVNRevision.Number(1); } try { return new SVNRevision.DateSpec(DATE_FORMAT.parse(value)); } catch (ParseException ex) { return null; // should not happen } }
Example 2
Source File: SvnSearch.java From netbeans with Apache License 2.0 | 4 votes |
@NbBundle.Messages({ "# {0} - resource URL", "MSG_SvnSearch.error.pathNotFound=Resource does not exist: {0}" }) private void listLogEntries() { noContentPanel.setLabel(org.openide.util.NbBundle.getMessage(SvnSearch.class, "LBL_NoResults_SearchInProgress")); // NOI18N panel.listPanel.setVisible(false); panel.noContentPanel.setVisible(true); final SVNRevision revisionFrom = getRevisionFrom(); final SVNUrl repositoryUrl = this.repositoryFiles[0].getRepositoryUrl(); if(revisionFrom instanceof SVNRevision.DateSpec) { SvnModuleConfig.getDefault().getPreferences().put(DATE_FROM, panel.dateFromTextField.getText().trim()); } final String[] paths = new String[repositoryFiles.length]; for(int i = 0; i < repositoryFiles.length; i++) { String[] segments = repositoryFiles[i].getPathSegments(); StringBuilder sb = new StringBuilder(); for(String segment : segments) { sb.append(segment); sb.append('/'); } paths[i] = sb.toString(); } RequestProcessor rp = Subversion.getInstance().getRequestProcessor(); support = new SvnProgressSupport() { @Override protected void perform() { ISVNLogMessage[] messageArray= null; try { SvnClient client = Subversion.getInstance().getClient(repositoryUrl, this); messageArray = SvnUtils.getLogMessages(client, repositoryUrl, paths, null, SVNRevision.HEAD, revisionFrom, false, false, 0); } catch (SVNClientException ex) { if (SvnClientExceptionHandler.isFileNotFoundInRevision(ex.getMessage())) { for (int i=0; i < paths.length; ++i) { String path = paths[i]; while (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } if (ex.getMessage().contains(path)) { noContentPanel.setLabel(Bundle.MSG_SvnSearch_error_pathNotFound(paths[i])); SvnClientExceptionHandler.notifyException(ex, false, false); return; } } } SvnClientExceptionHandler.notifyException(ex, true, true); } if(isCanceled()) { return; } if(messageArray == null) { return; } final List<ISVNLogMessage> messages = new ArrayList<ISVNLogMessage>(); if(revisionFrom instanceof SVNRevision.DateSpec) { long timeFrom = ((SVNRevision.DateSpec) revisionFrom).getDate().getTime(); for(ISVNLogMessage lm : messageArray) { if(lm.getDate().getTime() >= timeFrom) { messages.add(lm); } } } else { long revision = ((SVNRevision.Number) revisionFrom).getNumber(); for(ISVNLogMessage lm : messageArray) { if(lm.getRevision().getNumber() >= revision) { messages.add(lm); } } } if(isCanceled()) { return; } EventQueue.invokeLater(new Runnable() { @Override public void run() { panel.listPanel.setVisible(true); panel.noContentPanel.setVisible(false); searchView.setResults(messages.toArray(new ISVNLogMessage[messages.size()])); } }); } }; support.start(rp, repositoryUrl, org.openide.util.NbBundle.getMessage(SvnSearch.class, "LBL_Search_Progress")).addTaskListener( // NOI18N new TaskListener(){ @Override public void taskFinished(Task task) { support = null; } } ); }