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


Java Block類代碼示例

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


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

示例1: getBlock

import com.intellij.diff.Block; //導入依賴的package包/類
@Nullable
private Block getBlock(VcsFileRevision revision) throws FilesTooBigForDiffException, VcsException {
  if (myRevisionToContentMap.containsKey(revision)) {
    return myRevisionToContentMap.get(revision);
  }

  final String revisionContent = getContentOf(revision);
  if (revisionContent == null) return null;

  int index = myRevisions.indexOf(revision);
  Block blockByIndex = getBlock(index);
  if (blockByIndex == null) return null;

  myRevisionToContentMap.put(revision, new FindBlock(revisionContent, blockByIndex).getBlockInThePrevVersion());
  return myRevisionToContentMap.get(revision);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:17,代碼來源:VcsHistoryDialog.java

示例2: filteredRevisions

import com.intellij.diff.Block; //導入依賴的package包/類
private List<VcsFileRevision> filteredRevisions() {
  ArrayList<VcsFileRevision> result = new ArrayList<>();
  BlockData data = myBlockLoader.getLoadedData();

  int firstRevision;
  boolean foundInitialRevision = false;
  for (firstRevision = myRevisions.size() - 1; firstRevision > 0; firstRevision--) {
    Block block = data.getBlock(firstRevision);
    if (block == EMPTY_BLOCK) foundInitialRevision = true;
    if (block != null && block != EMPTY_BLOCK) break;
  }
  if (!foundInitialRevision && data.isLoading()) firstRevision = myRevisions.size() - 1;

  result.add(myRevisions.get(firstRevision));

  for (int i = firstRevision - 1; i >= 0; i--) {
    Block block1 = data.getBlock(i + 1);
    Block block2 = data.getBlock(i);
    if (block1 == null || block2 == null) continue;
    if (block1.getLines().equals(block2.getLines())) continue;
    result.add(myRevisions.get(i));
  }

  Collections.reverse(result);
  return result;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:27,代碼來源:VcsSelectionHistoryDialog.java

示例3: doRevert

import com.intellij.diff.Block; //導入依賴的package包/類
protected void doRevert() throws IOException, FilesTooBigForDiffException {
  Block b = myCalculator.getSelectionFor(myLeftRevision, new Progress() {
    public void processed(int percentage) {
      // should be already processed.
    }
  });

  Document d = myGateway.getDocument(myRightEntry.getPath());

  int from = d.getLineStartOffset(myFromLine);
  int to = d.getLineEndOffset(myToLine);

  d.replaceString(from, to, b.getBlockContent());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:SelectionReverter.java

示例4: testSelectionWasNotChanged

import com.intellij.diff.Block; //導入依賴的package包/類
@Test
public void testSelectionWasNotChanged() throws FilesTooBigForDiffException {
  List<Revision> rr = createRevisions("abc\ndef\nghi", "abc1\ndef1\nghi1");
  SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 2);

  Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());
  Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());

  assertBlock(0, 2, "abc1\ndef1\nghi1", b0);
  assertBlock(0, 2, "abc\ndef\nghi", b1);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:SelectionCalculatorTest.java

示例5: testSelectionWasMoved

import com.intellij.diff.Block; //導入依賴的package包/類
@Test
public void testSelectionWasMoved() throws FilesTooBigForDiffException {
  List<Revision> rr = createRevisions("abc\ndef\nghi", "def\nghi");
  SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 1);

  Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());
  Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());

  assertBlock(0, 1, "def\nghi", b0);
  assertBlock(1, 2, "def\nghi", b1);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:SelectionCalculatorTest.java

示例6: testSelectionForVeryOldRevisionTakenBackward

import com.intellij.diff.Block; //導入依賴的package包/類
@Test
public void testSelectionForVeryOldRevisionTakenBackward() throws FilesTooBigForDiffException {
  List<Revision> rr = createRevisions("ghi\nabc\ndef", "abc\nghi\ndef", "abc\ndef\nghi");
  SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 1);

  Block b2 = c.getSelectionFor(rr.get(2), new NullProgress());
  Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());
  Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());

  assertBlock(0, 1, "abc\ndef", b0);
  assertBlock(0, 2, "abc\nghi\ndef", b1);
  assertBlock(1, 2, "abc\ndef", b2);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:SelectionCalculatorTest.java

示例7: testNormalizingLineEnds

import com.intellij.diff.Block; //導入依賴的package包/類
@Test
public void testNormalizingLineEnds() throws FilesTooBigForDiffException {
  List<Revision> rr = createRevisions("abc\ndef\nghi", "abc\r\ndef\r\nghi");
  SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 1);

  Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());
  Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());

  assertBlock(0, 1, "abc\ndef", b0);
  assertBlock(0, 1, "abc\ndef", b1);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:SelectionCalculatorTest.java

示例8: createDiffContent

import com.intellij.diff.Block; //導入依賴的package包/類
@Nullable
private DiffContent createDiffContent(int index, @Nonnull BlockData data) {
  if (index >= myRevisions.size()) return DiffContentFactory.getInstance().createEmpty();
  Block block = data.getBlock(index);
  if (block == null) return null;
  if (block == EMPTY_BLOCK) return DiffContentFactory.getInstance().createEmpty();
  return DiffContentFactory.getInstance().create(block.getBlockContent(), myFile.getFileType());
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:9,代碼來源:VcsSelectionHistoryDialog.java

示例9: BlockLoader

import com.intellij.diff.Block; //導入依賴的package包/類
public BlockLoader(@Nonnull List<VcsFileRevision> revisions,
                   @Nonnull VirtualFile file,
                   @Nonnull Document document,
                   int selectionStart,
                   int selectionEnd) {
  myRevisions = revisions;
  myCharset = file.getCharset();

  String[] lastContent = Block.tokenize(document.getText());
  myBlocks.add(new Block(lastContent, selectionStart, selectionEnd + 1));
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:12,代碼來源:VcsSelectionHistoryDialog.java

示例10: start

import com.intellij.diff.Block; //導入依賴的package包/類
public void start(@Nonnull Disposable disposable) {
  BackgroundTaskUtil.executeOnPooledThread(disposable, () -> {
    try {
      // first block is loaded in constructor
      for (int index = 1; index < myRevisions.size(); index++) {
        ProgressManager.checkCanceled();

        Block block = myBlocks.get(index - 1);
        VcsFileRevision revision = myRevisions.get(index);

        synchronized (LOCK) {
          myCurrentLoadingRevision = revision;
        }
        notifyUpdate();

        Block previousBlock = createBlock(block, revision);

        synchronized (LOCK) {
          myBlocks.add(previousBlock);
        }
        notifyUpdate();
      }
    }
    catch (VcsException e) {
      synchronized (LOCK) {
        myException = e;
      }
      notifyError(e);
    }
    finally {
      synchronized (LOCK) {
        myIsLoading = false;
        myCurrentLoadingRevision = null;
      }
      notifyUpdate();
    }
  });
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:39,代碼來源:VcsSelectionHistoryDialog.java

示例11: createBlock

import com.intellij.diff.Block; //導入依賴的package包/類
@Nonnull
private Block createBlock(@Nonnull Block block, @Nonnull VcsFileRevision revision) throws VcsException {
  if (block == EMPTY_BLOCK) return EMPTY_BLOCK;

  String revisionContent = loadContents(revision);

  Block newBlock = block.createPreviousBlock(revisionContent);
  return newBlock.getStart() != newBlock.getEnd() ? newBlock : EMPTY_BLOCK;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:10,代碼來源:VcsSelectionHistoryDialog.java

示例12: BlockData

import com.intellij.diff.Block; //導入依賴的package包/類
public BlockData(boolean isLoading,
                 @Nonnull List<Block> blocks,
                 @Nullable VcsException exception,
                 @Nullable VcsFileRevision currentLoadingRevision) {
  myIsLoading = isLoading;
  myBlocks = blocks;
  myException = exception;
  myCurrentLoadingRevision = currentLoadingRevision;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:10,代碼來源:VcsSelectionHistoryDialog.java

示例13: getSelectionFor

import com.intellij.diff.Block; //導入依賴的package包/類
public Block getSelectionFor(Revision r, Progress p) throws FilesTooBigForDiffException {
  return doGetSelectionFor(r, p);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:SelectionCalculator.java

示例14: doGetSelectionFor

import com.intellij.diff.Block; //導入依賴的package包/類
private Block doGetSelectionFor(Revision r, Progress p) throws FilesTooBigForDiffException {
  int target = myRevisions.indexOf(r);
  return getSelectionFor(target, target + 1, p);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:SelectionCalculator.java

示例15: assertBlock

import com.intellij.diff.Block; //導入依賴的package包/類
private void assertBlock(int from, int to, String content, Block b) {
  assertEquals(from, b.getStart());
  assertEquals(to, b.getEnd());
  assertEquals(content, b.getBlockContent());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:SelectionCalculatorTest.java


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