当前位置: 首页>>代码示例>>Java>>正文


Java ComparisonPolicy.DEFAULT属性代码示例

本文整理汇总了Java中com.intellij.openapi.diff.impl.ComparisonPolicy.DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java ComparisonPolicy.DEFAULT属性的具体用法?Java ComparisonPolicy.DEFAULT怎么用?Java ComparisonPolicy.DEFAULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.openapi.diff.impl.ComparisonPolicy的用法示例。


在下文中一共展示了ComparisonPolicy.DEFAULT属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkNoDifferenceAndNotify

private boolean checkNoDifferenceAndNotify(DiffPanel diffPanel, DiffRequest data, final Window window, final boolean showMessage) {
  if (diffPanel.hasDifferences() || data.getHints().contains(HINT_ALLOW_NO_DIFFERENCES)) {
    return false;
  }

  DiffManagerImpl manager = (DiffManagerImpl)DiffManager.getInstance();
  ComparisonPolicy oldPolicy = manager.getComparisonPolicy();
  if (oldPolicy != ComparisonPolicy.DEFAULT) {
    manager.setComparisonPolicy(ComparisonPolicy.DEFAULT);
    Disposable parentDisposable = Disposer.newDisposable();
    DiffPanel maybeDiffPanel = DiffManagerImpl.createDiffPanel(data, window, parentDisposable, this);
    manager.setComparisonPolicy(oldPolicy);

    boolean hasDiffs = maybeDiffPanel.hasDifferences();
    Disposer.dispose(parentDisposable);

    if (hasDiffs) {
      return false;
    }
  }

  return !showMessage || !askForceOpenDiff(data);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FrameDiffTool.java

示例2: testChangedSpaceCorrection

public void testChangedSpaceCorrection() throws FilesTooBigForDiffException {
  DiffCorrection correction = new DiffCorrection.ChangedSpace(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = correction.correct(new DiffFragment[]{
      new DiffFragment("x", "y"),
      new DiffFragment(" ", "   "),
      new DiffFragment("ab", "ab"),
      new DiffFragment(" ", " "),
      new DiffFragment(" ", " w o r d"),
      new DiffFragment("   ", " w o r d")});
  CHECK.compareAll(new DiffFragment[]{
    new DiffFragment("x", "y"),
    new DiffFragment(null, "  "), new DiffFragment(" ", " "),
    new DiffFragment("ab", "ab"),
    new DiffFragment(" ", " "),
    new DiffFragment(" ", " "), new DiffFragment(null, "w o r d"),
    new DiffFragment("  ", null), new DiffFragment(" ", " "), new DiffFragment(null, "w o r d")}, fragments);

  fragments = correction.correct(new DiffFragment[]{new DiffFragment("\n  ", "\n ")});
  CHECK.compareAll(new DiffFragment[]{new DiffFragment("\n", "\n"),
                                      new DiffFragment(" ", null), new DiffFragment(" ", " ")}, fragments);
  fragments = correction.correct(new DiffFragment[]{new DiffFragment("\n", "\n\n")});
  CHECK.compareAll(new DiffFragment[]{new DiffFragment("\n", "\n"), new DiffFragment(null, "\n")}, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CorrectionTest.java

示例3: getState

@Nullable
@Override
public Element getState() {
  Element state = new Element("state");
  myProperties.writeExternal(state);
  if (myComparisonPolicy != ComparisonPolicy.DEFAULT) {
    state.setAttribute(COMPARISON_POLICY_ATTR_NAME, myComparisonPolicy.getName());
  }
  if (myHighlightMode != HighlightMode.BY_WORD) {
    state.setAttribute(HIGHLIGHT_MODE_ATTR_NAME, myHighlightMode.name());
  }
  return state;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DiffManagerImpl.java

示例4: testTrueLineBlock

public void testTrueLineBlock() throws FilesTooBigForDiffException {
  DiffCorrection.TrueLineBlocks correction = new DiffCorrection.TrueLineBlocks(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = correction.correctAndNormalize(new DiffFragment[]{
    DiffFragment.unchanged(" 1\n  ab\n x\n", "  2\n ab\n x\n"),
    new DiffFragment("XXX\n111\n", "YYY\n222\n"),
    DiffFragment.unchanged(" a\n", "  a\n")});
  CHECK.compareAll(new DiffFragment[]{new DiffFragment(" 1\n", "  2\n"),
                                      new DiffFragment("  ab\n", " ab\n"),
                                      new DiffFragment(" x\n", " x\n"),
                                      new DiffFragment("XXX\n111\n", "YYY\n222\n"),
                                      new DiffFragment(" a\n", "  a\n")},
                   fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CorrectionTest.java

示例5: testTrueLineBlocksWithSameLines

public void testTrueLineBlocksWithSameLines() throws FilesTooBigForDiffException {
  DiffCorrection.TrueLineBlocks correction = new DiffCorrection.TrueLineBlocks(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = correction.correctAndNormalize(new DiffFragment[]{
    DiffFragment.unchanged(" X\n  X\n  X", "  X\n X\n  X")});
  CHECK.compareAll(new DiffFragment[]{new DiffFragment(" X\n  X\n", "  X\n X\n"),
                                      new DiffFragment("  X", "  X")},
                   fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:CorrectionTest.java

示例6: test1

public void test1() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments("abc def, 123", "ab def, 12");
  CHECK.compareAll(new DiffFragment[]{new DiffFragment("abc", "ab"),
                                      new DiffFragment(" def, ", " def, "),
                                      new DiffFragment("123", "12")}, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ByWordTest.java

示例7: test2

public void test2() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments(" a[xy]+1", ",a[]+1");
  CHECK.compareAll(new DiffFragment[]{new DiffFragment(" ", null),
                                      new DiffFragment(null, ","),
                                      new DiffFragment("a[", "a["),
                                      new DiffFragment("xy", null),
                                      new DiffFragment("]+1", "]+1")}, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ByWordTest.java

示例8: test4

public void test4() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments("  abc\n2222\n", "    x = abc\nzzzz\n");
  CHECK.compareAll(new DiffFragment[]{
    new DiffFragment(null, "  "), new DiffFragment("  ", "  "), new DiffFragment(null, "x"), new DiffFragment(null, " ="),
    new DiffFragment(null, " "),
    new DiffFragment("abc\n", "abc\n"),
    new DiffFragment("2222", "zzzz"),
    new DiffFragment("\n", "\n")}, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ByWordTest.java

示例9: testIdea58505

public void testIdea58505() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments("   if (eventMerger!=null && !dataSelection.getValueIsAdjusting()) {",
                                                   "   if (eventMerger!=null && (dataSelection==null || !dataSelection.getValueIsAdjusting())) {");
  CHECK.compareAll(new DiffFragment[] {
    new DiffFragment("   if (eventMerger!=null && ", "   if (eventMerger!=null && "),
    new DiffFragment("!", "("),
    new DiffFragment("dataSelection", "dataSelection"),
    new DiffFragment(null, "=="),
    new DiffFragment(null, "null || !dataSelection"),
    new DiffFragment(".getValueIsAdjusting())", ".getValueIsAdjusting())"),
    new DiffFragment(null, ")"),
    new DiffFragment(" {", " {")
  }, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ByWordTest.java

示例10: testIdea56428

public void testIdea56428() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments("messageInsertStatement = connection.prepareStatement(\"INSERT INTO AUDIT (AUDIT_TYPE_ID, STATUS, SERVER_ID, INSTANCE_ID, REQUEST_ID) VALUES (?, ?, ?, ?, ?)\");\n",
                                                   "messageInsertStatement = connection.prepareStatement(\"INSERT INTO AUDIT (AUDIT_TYPE_ID, CREATION_TIMESTAMP, STATUS, SERVER_ID, INSTANCE_ID, REQUEST_ID) VALUES (?, ?, ?, ?, ?, ?)\");\n");
  CHECK.compareAll(new DiffFragment[] {
    new DiffFragment("messageInsertStatement = connection.prepareStatement(\"INSERT INTO AUDIT (AUDIT_TYPE_ID, ", "messageInsertStatement = connection.prepareStatement(\"INSERT INTO AUDIT (AUDIT_TYPE_ID, "),
    new DiffFragment(null, "CREATION_TIMESTAMP"),
    new DiffFragment(null, ","),
    new DiffFragment(null, " "),
    new DiffFragment("STATUS, SERVER_ID, INSTANCE_ID, REQUEST_ID) VALUES (?, ?, ?, ?, ?", "STATUS, SERVER_ID, INSTANCE_ID, REQUEST_ID) VALUES (?, ?, ?, ?, ?"),
    new DiffFragment(null, ", ?"),
    new DiffFragment(")\");\n", ")\");\n"),
  }, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ByWordTest.java

示例11: testLeadingFormatting

public void testLeadingFormatting() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments(" abc\n 123", " 123");
  CHECK.compareAll(new DiffFragment[]{new DiffFragment(" abc\n", null),
                                      new DiffFragment(" 123", " 123")},
                   UniteSameType.INSTANCE.correct(fragments));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ByWordTest.java

示例12: testRestyleNewLines

public void testRestyleNewLines() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments("f(a, b);", "f(a,\n  b);");
  CHECK.compareAll(new DiffFragment[]{new DiffFragment("f(a,", "f(a,"),
                                      new DiffFragment(" ", "\n  "),
                                      new DiffFragment("b);", "b);")},
                   UniteSameType.INSTANCE.correct(fragments));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ByWordTest.java

示例13: test3

public void test3() throws FilesTooBigForDiffException {
  DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
  DiffFragment[] fragments = byWord.buildFragments("0987\n  a.g();\n", "yyyy\n");
  CHECK.compareAll(new DiffFragment[]{new DiffFragment("0987\n  a.g();\n", "yyyy\n")}, fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ByWordTest.java

示例14: test

public void test() throws FilesTooBigForDiffException {
  DiffPolicy.LineBlocks diffPolicy = new DiffPolicy.LineBlocks(ComparisonPolicy.DEFAULT);
  checkPolicy(diffPolicy, "abc\n123\n", "ABC\nXYZ\n");
  checkPolicy(diffPolicy, "abc\n123", "ABC\nXYZ");
  checkPolicy(diffPolicy, "abc\n123\n", "ABC\nXYZ");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:LineBlocksDiffPolicyTest.java


注:本文中的com.intellij.openapi.diff.impl.ComparisonPolicy.DEFAULT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。