本文整理汇总了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));
}