类com.intellij.psi.codeStyle.ChangedRangesInfo源码实例Demo

下面列出了怎么用com.intellij.psi.codeStyle.ChangedRangesInfo的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: consulo   文件: ChangedRangesUtil.java

@Nonnull
static List<TextRange> processChangedRanges(@Nonnull PsiFile file, @Nonnull ChangedRangesInfo changedRangesInfo) {
  Document document = file.getViewProvider().getDocument();
  List<TextRange> result = new ArrayList<>();
  if (document != null) {
    FormattingRangesExtender extender = new FormattingRangesExtender(document, file);
    for (TextRange range : changedRangesInfo.allChangedRanges) {
      List<TextRange> extended = extender.getExtendedRanges(Collections.singletonList(range));
      result.addAll(extended);
    }
  }
  else {
    result.addAll(changedRangesInfo.allChangedRanges);
  }
  return optimizedChangedRanges(result);
}
 

@Override
public void reformatTextWithContext(PsiFile file, ChangedRangesInfo info) {
  if (overrideFormatterForFile(file)) {
    formatInternal(file, info);
  } else {
    super.reformatTextWithContext(file, info);
  }
}
 

private void formatInternal(PsiFile file, ChangedRangesInfo info) {
  List<TextRange> ranges = new ArrayList<>();
  if (info.insertedRanges != null) {
    ranges.addAll(info.insertedRanges);
  }
  ranges.addAll(info.allChangedRanges);
  formatInternal(file, ranges);
}
 
源代码4 项目: consulo   文件: FormatTextRanges.java

public FormatTextRanges(@Nonnull ChangedRangesInfo changedRangesInfo, @Nonnull List<TextRange> contextRanges) {
  myInsertedRanges = changedRangesInfo.insertedRanges;
  boolean processHeadingWhitespace = false;
  for (TextRange range : contextRanges) {
    add(range, processHeadingWhitespace);
    processHeadingWhitespace = true;
  }
}
 

@Override
public void reformatTextWithContext(PsiFile file, ChangedRangesInfo info) throws IncorrectOperationException {
	this.delegate.reformatTextWithContext(file, info);
}
 

@Override
public void reformatTextWithContext(PsiFile file, ChangedRangesInfo info)
    throws IncorrectOperationException {
  delegate.reformatTextWithContext(file, info);
}
 

@Override
public void reformatTextWithContext(PsiFile psiFile, ChangedRangesInfo changedRangesInfo)
    throws IncorrectOperationException {
  delegate.reformatTextWithContext(psiFile, changedRangesInfo);
}
 

@Override
public void reformatTextWithContext(@NotNull PsiFile psiFile, @NotNull ChangedRangesInfo changedRangesInfo) throws IncorrectOperationException {
	original.reformatTextWithContext(psiFile, changedRangesInfo);
}
 
 类所在包
 类方法
 同包方法