当前位置: 首页>>代码示例>>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;未经允许,请勿转载。