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


Java DebugUtil.treeToBuffer方法代码示例

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


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

示例1: assertInvalidRanges

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
public static void assertInvalidRanges(final int startOffset, final int newEndOffset, FormattingDocumentModel model, String message) {
  @NonNls final StringBuilder buffer = new StringBuilder();
  buffer.append("Invalid formatting blocks:").append(message).append("\n");
  buffer.append("Start offset:");
  buffer.append(startOffset);
  buffer.append(" end offset:");
  buffer.append(newEndOffset);
  buffer.append("\n");

  int minOffset = Math.max(Math.min(startOffset, newEndOffset) - 20, 0);
  int maxOffset = Math.min(Math.max(startOffset, newEndOffset) + 20, model.getTextLength());

  buffer.append("Affected text fragment:[").append(minOffset).append(",").append(maxOffset).append("] - '")
    .append(model.getText(new TextRange(minOffset, maxOffset))).append("'\n");

  final StringBuilder messageBuffer =  new StringBuilder();
  messageBuffer.append("Invalid ranges during formatting");
  if (model instanceof FormattingDocumentModelImpl) {
    messageBuffer.append(" in ").append(((FormattingDocumentModelImpl)model).getFile().getLanguage());
  }

  buffer.append("File text:(").append(model.getTextLength()).append(")\n'");
  buffer.append(model.getText(new TextRange(0, model.getTextLength())).toString());
  buffer.append("'\n");
  buffer.append("model (").append(model.getClass()).append("): ").append(model);

  if (model instanceof FormattingDocumentModelImpl) {
    final FormattingDocumentModelImpl modelImpl = (FormattingDocumentModelImpl)model;
    buffer.append("Psi Tree:\n");
    final PsiFile file = modelImpl.getFile();
    final List<PsiFile> roots = file.getViewProvider().getAllFiles();
    for (PsiFile root : roots) {
      buffer.append("Root ");
      DebugUtil.treeToBuffer(buffer, root.getNode(), 0, false, true, true, true);
    }
    buffer.append('\n');
  }

  LogMessageEx.error(LOG, messageBuffer.toString(), buffer.toString());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:InitialInfoBuilder.java

示例2: assertInvalidRanges

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
public static void assertInvalidRanges(final int startOffset, final int newEndOffset, FormattingDocumentModel model, String message) {
  @NonNls final StringBuilder buffer = new StringBuilder();
  buffer.append("Invalid formatting blocks:").append(message).append("\n");
  buffer.append("Start offset:");
  buffer.append(startOffset);
  buffer.append(" end offset:");
  buffer.append(newEndOffset);
  buffer.append("\n");

  int minOffset = Math.max(Math.min(startOffset, newEndOffset) - 20, 0);
  int maxOffset = Math.min(Math.max(startOffset, newEndOffset) + 20, model.getTextLength());

  buffer.append("Affected text fragment:[").append(minOffset).append(",").append(maxOffset).append("] - '")
    .append(model.getText(new TextRange(minOffset, maxOffset))).append("'\n");

  final StringBuilder messageBuffer =  new StringBuilder();
  messageBuffer.append("Invalid ranges during formatting");
  if (model instanceof FormattingDocumentModelImpl) {
    messageBuffer.append(" in ").append(((FormattingDocumentModelImpl)model).getFile().getLanguage());
  }

  buffer.append("File text:(").append(model.getTextLength()).append(")\n'");
  buffer.append(model.getText(new TextRange(0, model.getTextLength())).toString());
  buffer.append("'\n");
  buffer.append("model (").append(model.getClass()).append("): ").append(model);

  Throwable currentThrowable = new Throwable();
  if (model instanceof FormattingDocumentModelImpl) {
    final FormattingDocumentModelImpl modelImpl = (FormattingDocumentModelImpl)model;
    buffer.append("Psi Tree:\n");
    final PsiFile file = modelImpl.getFile();
    final List<PsiFile> roots = file.getViewProvider().getAllFiles();
    for (PsiFile root : roots) {
      buffer.append("Root ");
      DebugUtil.treeToBuffer(buffer, root.getNode(), 0, false, true, true, true);
    }
    buffer.append('\n');
    currentThrowable = makeLanguageStackTrace(currentThrowable, file);
  }

  LogMessageEx.error(LOG, messageBuffer.toString(), currentThrowable, buffer.toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:InitialInfoBuilder.java

示例3: assertInvalidRanges

import com.intellij.psi.impl.DebugUtil; //导入方法依赖的package包/类
public void assertInvalidRanges(final int startOffset, final int newEndOffset, FormattingDocumentModel model, String message) {
  final StringBuilder buffer = new StringBuilder();
  buffer.append("Invalid formatting blocks:").append(message).append("\n");
  buffer.append("Start offset:");
  buffer.append(startOffset);
  buffer.append(" end offset:");
  buffer.append(newEndOffset);
  buffer.append("\n");

  int minOffset = Math.max(Math.min(startOffset, newEndOffset) - 20, 0);
  int maxOffset = Math.min(Math.max(startOffset, newEndOffset) + 20, model.getTextLength());

  buffer.append("Affected text fragment:[").append(minOffset).append(",").append(maxOffset).append("] - '")
          .append(model.getText(new TextRange(minOffset, maxOffset))).append("'\n");

  final StringBuilder messageBuffer =  new StringBuilder();
  messageBuffer.append("Invalid ranges during formatting");
  if (model instanceof FormattingDocumentModelImpl) {
    messageBuffer.append(" in ").append(((FormattingDocumentModelImpl)model).getFile().getLanguage());
  }

  buffer.append("File text:(").append(model.getTextLength()).append(")\n'");
  buffer.append(model.getText(new TextRange(0, model.getTextLength())).toString());
  buffer.append("'\n");
  buffer.append("model (").append(model.getClass()).append("): ").append(model);

  Throwable currentThrowable = new Throwable();
  if (model instanceof FormattingDocumentModelImpl) {
    final FormattingDocumentModelImpl modelImpl = (FormattingDocumentModelImpl)model;
    buffer.append("Psi Tree:\n");
    final PsiFile file = modelImpl.getFile();
    final List<PsiFile> roots = file.getViewProvider().getAllFiles();
    for (PsiFile root : roots) {
      buffer.append("Root ");
      DebugUtil.treeToBuffer(buffer, root.getNode(), 0, false, true, true, true);
    }
    buffer.append('\n');
    currentThrowable = makeLanguageStackTrace(currentThrowable, file);
  }

  LogMessageEx.error(LOG, messageBuffer.toString(), currentThrowable, buffer.toString());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:43,代码来源:RangesAssert.java


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