當前位置: 首頁>>代碼示例>>Java>>正文


Java FileRevisionTimestampComparator類代碼示例

本文整理匯總了Java中com.intellij.history.FileRevisionTimestampComparator的典型用法代碼示例。如果您正苦於以下問題:Java FileRevisionTimestampComparator類的具體用法?Java FileRevisionTimestampComparator怎麽用?Java FileRevisionTimestampComparator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FileRevisionTimestampComparator類屬於com.intellij.history包,在下文中一共展示了FileRevisionTimestampComparator類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ByteContentRetriever

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
public ByteContentRetriever(IdeaGateway gateway, LocalHistoryFacade vcs, VirtualFile file, FileRevisionTimestampComparator c) {
  super(file.getPath());
  myVcs = vcs;
  myComparator = c;

  Entry e = gateway.createTransientEntry(file);
  myCurrentFileContent = e.getContent();
  myCurrentFileTimestamp = e.getTimestamp();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ByteContentRetriever.java

示例2: testGettingMostRecentRevisionContent

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
public void testGettingMostRecentRevisionContent() throws Exception {
  setContent(f, "1", TIMESTAMP_INCREMENT);
  setContent(f, "2", TIMESTAMP_INCREMENT * 2);

  FileRevisionTimestampComparator c = new FileRevisionTimestampComparator() {
    @Override
    public boolean isSuitable(long revisionTimestamp) {
      return revisionTimestamp < 10000;
    }
  };
  assertContentAt(c, "2");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:GettingContentAtDateTest.java

示例3: comparator

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
private FileRevisionTimestampComparator comparator(final long timestamp) {
  return new FileRevisionTimestampComparator() {
    @Override
    public boolean isSuitable(long revisionTimestamp) {
      return revisionTimestamp == timestamp;
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:GettingContentAtDateTest.java

示例4: getLastUpToDateContentFor

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
@Nullable
public byte[] getLastUpToDateContentFor(@NotNull final VirtualFile f) {
  final VirtualFile parent = f.getParent();
  final String name = f.getName();
  final Entry entry = myEntriesManager.getEntryFor(parent, name);
  if (entry != null && entry.isResultOfMerge()) {
    // try created by VCS during merge
    final byte[] content = CvsUtil.getStoredContentForFile(f, entry.getRevision());
    if (content != null) {
      return content;
    }
    // try cached by IDEA in CVS dir
    return CvsUtil.getCachedStoredContent(parent, name, entry.getRevision());
  }
  final long upToDateTimestamp = getUpToDateTimeForFile(f);
  final FileRevisionTimestampComparator c = new FileRevisionTimestampComparator() {
    @Override
    public boolean isSuitable(long revisionTimestamp) {
      return CvsStatusProvider.timeStampsAreEqual(upToDateTimestamp, revisionTimestamp);
    }
  };
  final byte[] localHistoryContent = LocalHistory.getInstance().getByteContent(f, c);
  if (localHistoryContent == null) {
    if (entry != null && CvsUtil.haveCachedContent(f, entry.getRevision())) {
      return CvsUtil.getCachedStoredContent(parent, name, entry.getRevision());
    }
  }
  return localHistoryContent;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:CvsChangeProvider.java

示例5: doGetLineMapping

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
@javax.annotation.Nullable
private SoftReference<TIntIntHashMap> doGetLineMapping(final long date, boolean oldToNew) {
  final VirtualFile f = getVirtualFile();
  final byte[] oldContent;
  synchronized (LOCK) {
    if (myOldContent == null) {
      if (ApplicationManager.getApplication().isDispatchThread()) return null;
      final byte[] byteContent = LocalHistory.getInstance().getByteContent(f, new FileRevisionTimestampComparator() {
        public boolean isSuitable(long revisionTimestamp) {
          return revisionTimestamp < date;
        }
      });
      myOldContent = new SoftReference<byte[]>(byteContent);
    }
    oldContent = myOldContent.get();
  }

  if (oldContent == null) return null;
  String[] coveredLines = getCoveredLines(oldContent, f);
  String[] currentLines = getUpToDateLines();

  String[] oldLines = oldToNew ? coveredLines : currentLines;
  String[] newLines = oldToNew ? currentLines : coveredLines;

  Diff.Change change = null;
  try {
    change = Diff.buildChanges(oldLines, newLines);
  }
  catch (FilesTooBigForDiffException e) {
    LOG.info(e);
    return null;
  }
  return new SoftReference<TIntIntHashMap>(getCoverageVersionToCurrentLineMapping(change, oldLines.length));
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:35,代碼來源:SrcFileAnnotator.java

示例6: assertContentAt

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
private void assertContentAt(FileRevisionTimestampComparator c, String expected) {
  byte[] actual = LocalHistory.getInstance().getByteContent(f, c);
  assertEquals(expected, actual == null ? null : new String(actual));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:GettingContentAtDateTest.java

示例7: doGetLineMapping

import com.intellij.history.FileRevisionTimestampComparator; //導入依賴的package包/類
@Nullable
private SoftReference<TIntIntHashMap> doGetLineMapping(final long date, boolean oldToNew) {
  final VirtualFile f = getVirtualFile();
  final byte[] oldContent;
  synchronized (LOCK) {
    if (myOldContent == null) {
      if (ApplicationManager.getApplication().isDispatchThread()) return null;
      final LocalHistory localHistory = LocalHistory.getInstance();
      byte[] byteContent = localHistory.getByteContent(f, new FileRevisionTimestampComparator() {
        public boolean isSuitable(long revisionTimestamp) {
          return revisionTimestamp < date;
        }
      });

      if (byteContent == null && f.getTimeStamp() > date) {
        byteContent = loadFromVersionControl(date, f);
      } 
      myOldContent = new SoftReference<byte[]>(byteContent);
    }
    oldContent = myOldContent.get();
  }

  if (oldContent == null) return null;
  String[] coveredLines = getCoveredLines(oldContent, f);
  final Document document = myDocument;
  if (document == null) return null;
  String[] currentLines = getUpToDateLines(document);

  String[] oldLines = oldToNew ? coveredLines : currentLines;
  String[] newLines = oldToNew ? currentLines : coveredLines;

  Diff.Change change;
  try {
    change = Diff.buildChanges(oldLines, newLines);
  }
  catch (FilesTooBigForDiffException e) {
    LOG.info(e);
    return null;
  }
  return new SoftReference<TIntIntHashMap>(getCoverageVersionToCurrentLineMapping(change, oldLines.length));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:42,代碼來源:SrcFileAnnotator.java


注:本文中的com.intellij.history.FileRevisionTimestampComparator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。