Java 类com.intellij.psi.formatter.WhiteSpaceFormattingStrategy 实例源码

项目:intellij-ce-playground    文件:AbstractXmlBlock.java   
public static boolean containsWhiteSpacesOnly(@NotNull ASTNode node) {
  PsiElement psiElement = node.getPsi();
  if (psiElement instanceof PsiWhiteSpace) return true;
  Language nodeLang = psiElement.getLanguage();
  if (!nodeLang.isKindOf(XMLLanguage.INSTANCE) ||
      isTextOnlyNode(node) ||
      node.getElementType() == XmlElementType.XML_PROLOG) {
    WhiteSpaceFormattingStrategy strategy = WhiteSpaceFormattingStrategyFactory.getStrategy(nodeLang);
    int length = node.getTextLength();
    return strategy.check(node.getChars(), 0, length) >= length;
  }
  return false;
}
项目:tools-idea    文件:AbstractXmlBlock.java   
public static boolean containsWhiteSpacesOnly(ASTNode node) {
  WhiteSpaceFormattingStrategy strategy =  WhiteSpaceFormattingStrategyFactory.getStrategy(node.getPsi().getLanguage());
  String nodeText = node.getText();
  int length = nodeText.length();
  return strategy.check(nodeText, 0, length) >= length;
}
项目:consulo-xml    文件:AbstractXmlBlock.java   
public static boolean containsWhiteSpacesOnly(ASTNode node) {
  WhiteSpaceFormattingStrategy strategy =  WhiteSpaceFormattingStrategyFactory.getStrategy(node.getPsi().getLanguage());
  String nodeText = node.getText();
  int length = nodeText.length();
  return strategy.check(nodeText, 0, length) >= length;
}