コード例 #1
0
 @Override
 public void getRevisionFile(File originalFile, File revisionFile) {
   assert originalFile != null;
   if (originalFile == null) {
     LocalHistory.LOG.log(
         Level.FINE, "revision {0} requested for null file", se.getDate().getTime()); // NOI18N
     return;
   }
   LocalHistory.LOG.log(
       Level.FINE,
       "revision {0} requested for file {1}",
       new Object[] {se.getDate().getTime(), originalFile.getAbsolutePath()}); // NOI18N
   try {
     // we won't use the member store entry as that might have been
     // set for e.g. a stored .form while this is the according .java
     // file beeing requested. In case the storage can't find a revision it
     // returns the next nearest in time
     long ts = se.getTimestamp();
     StoreEntry storeEntry =
         LocalHistory.getInstance().getLocalHistoryStore().getStoreEntry(originalFile, ts);
     if (storeEntry != null) {
       FileUtils.copy(storeEntry.getStoreFileInputStream(), revisionFile);
     } else {
       LocalHistory.LOG.log(
           Level.WARNING,
           "No entry in Local History for file {0} {1} {2}",
           new Object[] {originalFile, new Date(ts), ts}); // NOI18N
     }
   } catch (IOException e) {
     LocalHistory.LOG.log(
         Level.WARNING,
         "Error while retrieving history for file {0} stored as {1}",
         new Object[] {se.getFile(), se.getStoreFile()}); // NOI18N
   }
 }
コード例 #2
0
 @Override
 protected void perform(final HistoryEntry entry, final Set<File> files) {
   LocalHistory.getInstance()
       .getParallelRequestProcessor()
       .post(
           new Runnable() {
             @Override
             public void run() {
               for (File file : files) {
                 StoreEntry se =
                     LocalHistory.getInstance()
                         .getLocalHistoryStore()
                         .getStoreEntry(file, entry.getDateTime().getTime());
                 if (se != null) {
                   perform(se);
                 }
               }
             }
           });
 }
コード例 #3
0
  @Override
  public HistoryEntry[] getHistory(File[] files, Date fromDate) {
    if (files == null || files.length == 0) {
      LocalHistory.LOG.log(
          Level.FINE,
          "LocalHistory requested for no files {0}",
          files != null ? files.length : null);
      return new HistoryEntry[0];
    }
    logFiles(files);

    Map<Long, HistoryEntry> storeEntries = new HashMap<Long, HistoryEntry>();
    for (File f : files) {
      StoreEntry[] ses = LocalHistory.getInstance().getLocalHistoryStore().getStoreEntries(f);
      for (StoreEntry se : ses) {
        if (!storeEntries.keySet().contains(se.getTimestamp())) {
          HistoryEntry e =
              new HistoryEntry(
                  files,
                  se.getDate(),
                  se.getLabel(),
                  "", // username         NOI18N
                  "", // username short   NOI18N
                  NbBundle.getMessage(
                      LocalHistoryProvider.class, "LBL_Local"), // revision         NOI18N
                  NbBundle.getMessage(
                      LocalHistoryProvider.class, "LBL_Local"), // revision short   NOI18N
                  getActions(),
                  new RevisionProviderImpl(se),
                  new MessageEditImpl(se));
          storeEntries.put(se.getTimestamp(), e);
        }
      }
    }
    logEntries(storeEntries.values());
    return storeEntries.values().toArray(new HistoryEntry[storeEntries.size()]);
  }
コード例 #4
0
 public LocalHistoryProvider() {
   LocalHistory.getInstance().getLocalHistoryStore().addVersioningListener(this);
 }
コード例 #5
0
 @Override
 void perform(StoreEntry se) {
   LocalHistory.getInstance()
       .getLocalHistoryStore()
       .deleteEntry(se.getFile(), se.getTimestamp());
 }
コード例 #6
0
 @Override
 public void setMessage(String message) throws IOException {
   LocalHistory.getInstance()
       .getLocalHistoryStore()
       .setLabel(se.getFile(), se.getTimestamp(), message);
 }