本文整理匯總了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();
}
示例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");
}
示例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;
}
};
}
示例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;
}
示例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));
}
示例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));
}
示例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));
}