本文整理汇总了Java中com.intellij.psi.formatter.FormatterUtil.containsWhiteSpacesOnly方法的典型用法代码示例。如果您正苦于以下问题:Java FormatterUtil.containsWhiteSpacesOnly方法的具体用法?Java FormatterUtil.containsWhiteSpacesOnly怎么用?Java FormatterUtil.containsWhiteSpacesOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.formatter.FormatterUtil
的用法示例。
在下文中一共展示了FormatterUtil.containsWhiteSpacesOnly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren() {
final ArrayList<Block> result = new ArrayList<Block>();
ASTNode child = myNode.getFirstChildNode();
Indent currentIndent = getLabelIndent();
Wrap currentWrap = null;
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){
result.add(createJavaBlock(child, mySettings, myJavaSettings, currentIndent, currentWrap, AlignmentStrategy.getNullStrategy()));
if (child.getElementType() == JavaTokenType.COLON) {
currentIndent = Indent.getNoneIndent();
currentWrap =Wrap.createWrap(WrapType.ALWAYS, true);
}
}
child = child.getTreeNext();
}
return result;
}
示例2: processHeadCommentsAndWhiteSpaces
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
private void processHeadCommentsAndWhiteSpaces(@NotNull List<Block> result) {
while (myCurrentChild != null) {
if (StdTokenSets.COMMENT_BIT_SET.contains(myCurrentChild.getElementType()) || myCurrentChild.getElementType() == JavaDocElementType.DOC_COMMENT) {
Block commentBlock = createJavaBlock(
myCurrentChild,
mySettings, myJavaSettings,
Indent.getNoneIndent(), null, AlignmentStrategy.getNullStrategy()
);
result.add(commentBlock);
myCurrentIndent = Indent.getNoneIndent();
}
else if (!FormatterUtil.containsWhiteSpacesOnly(myCurrentChild)) {
break;
}
myCurrentOffset += myCurrentChild.getTextLength();
myCurrentChild = myCurrentChild.getTreeNext();
}
}
示例3: processField
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
private ASTNode processField(@NotNull final List<Block> result,
ASTNode child,
@NotNull final AlignmentStrategy alignmentStrategy,
final Wrap defaultWrap,
final Indent childIndent) {
ASTNode lastFieldInGroup = findLastFieldInGroup(child);
if (lastFieldInGroup == child) {
result.add(createJavaBlock(child, getSettings(), myJavaSettings, childIndent, arrangeChildWrap(child, defaultWrap), alignmentStrategy));
return child;
}
else {
final ArrayList<Block> localResult = new ArrayList<Block>();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
localResult.add(createJavaBlock(
child, getSettings(), myJavaSettings,
Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS),
arrangeChildWrap(child, defaultWrap),
alignmentStrategy
)
);
}
if (child == lastFieldInGroup) break;
child = child.getTreeNext();
}
if (!localResult.isEmpty()) {
result.add(new SyntheticCodeBlock(localResult, null, getSettings(), myJavaSettings, childIndent, null));
}
return lastFieldInGroup;
}
}
示例4: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren() {
myChildrenBuilt = true;
if (isLeaf()) {
return EMPTY;
}
final ArrayList<TemplateLanguageBlock> tlChildren = new ArrayList<TemplateLanguageBlock>(5);
for (ASTNode childNode = getNode().getFirstChildNode(); childNode != null; childNode = childNode.getTreeNext()) {
if (FormatterUtil.containsWhiteSpacesOnly(childNode)) continue;
if (shouldBuildBlockFor(childNode)) {
final TemplateLanguageBlock childBlock = myBlockFactory
.createTemplateLanguageBlock(childNode, createChildWrap(childNode), createChildAlignment(childNode), null, mySettings);
childBlock.setParent(this);
tlChildren.add(childBlock);
}
}
final List<Block> children = (List<Block>)(myForeignChildren == null ? tlChildren : BlockUtil.mergeBlocks(tlChildren, myForeignChildren));
//BlockUtil.printBlocks(getTextRange(), children);
return BlockUtil.setParent(children, this);
}
示例5: collectNodes
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
private static void collectNodes(@NotNull List<ASTNode> nodes, @NotNull ASTNode node) {
ASTNode child = node.getFirstChildNode();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
IElementType type = child.getElementType();
if (type == JavaElementType.METHOD_CALL_EXPRESSION ||
type == JavaElementType.REFERENCE_EXPRESSION) {
collectNodes(nodes, child);
}
else {
nodes.add(child);
}
}
child = child.getTreeNext();
}
}
示例6: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren() {
final ArrayList<Block> result = new ArrayList<Block>();
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
if (child.getElementType() == JavaDocTokenType.DOC_COMMENT_START) {
result.add(createJavaBlock(child, mySettings, myJavaSettings, Indent.getNoneIndent(), null, AlignmentStrategy.getNullStrategy()));
} else if (!FormatterUtil.containsWhiteSpacesOnly(child) && !child.getText().trim().isEmpty()){
result.add(createJavaBlock(child, mySettings, myJavaSettings, Indent.getSpaceIndent(1), null, AlignmentStrategy.getNullStrategy()));
}
child = child.getTreeNext();
}
return result;
}
示例7: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren() {
final ArrayList<Block> result = new ArrayList<Block>();
ASTNode child = myNode.getFirstChildNode();
Indent currentIndent = getLabelIndent();
Wrap currentWrap = null;
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){
result.add(createJavaBlock(child, mySettings, currentIndent, currentWrap, AlignmentStrategy.getNullStrategy()));
if (child.getElementType() == ElementType.COLON) {
currentIndent = Indent.getNoneIndent();
currentWrap =Wrap.createWrap(WrapType.ALWAYS, true);
}
}
child = child.getTreeNext();
}
return result;
}
示例8: collectNodes
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
private static void collectNodes(@NotNull List<ASTNode> nodes, @NotNull ASTNode node) {
ASTNode child = node.getFirstChildNode();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
if (child.getElementType() == JavaElementType.METHOD_CALL_EXPRESSION || child.getElementType() ==
JavaElementType
.REFERENCE_EXPRESSION) {
collectNodes(nodes, child);
}
else {
nodes.add(child);
}
}
child = child.getTreeNext();
}
}
示例9: processEnumBlock
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Nullable
private ASTNode processEnumBlock(@NotNull List<Block> result,
@Nullable ASTNode child,
ASTNode last)
{
final WrappingStrategy wrappingStrategy = WrappingStrategy.createDoNotWrapCommaStrategy(Wrap
.createWrap(getWrapType(mySettings.ENUM_CONSTANTS_WRAP), true));
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0) {
result.add(createJavaBlock(child, mySettings, Indent.getNormalIndent(),
wrappingStrategy.getWrap(child.getElementType()), AlignmentStrategy.getNullStrategy()));
if (child == last) return child;
}
child = child.getTreeNext();
}
return null;
}
示例10: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren() {
final ArrayList<Block> result = new ArrayList<Block>();
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
if (child.getElementType() == JavaDocTokenType.DOC_COMMENT_START) {
result.add(createJavaBlock(child, mySettings, Indent.getNoneIndent(), null, AlignmentStrategy.getNullStrategy()));
} else if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getText().trim().length() > 0){
result.add(createJavaBlock(child, mySettings, Indent.getSpaceIndent(1), null, AlignmentStrategy.getNullStrategy()));
}
child = child.getTreeNext();
}
return result;
}
示例11: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren() {
myChildrenBuilt = true;
if (isLeaf()) {
return EMPTY;
}
final ArrayList<TemplateLanguageBlock> tlChildren = new ArrayList<>(5);
for (ASTNode childNode = getNode().getFirstChildNode(); childNode != null; childNode = childNode.getTreeNext()) {
if (FormatterUtil.containsWhiteSpacesOnly(childNode)) continue;
if (shouldBuildBlockFor(childNode)) {
final TemplateLanguageBlock childBlock = myBlockFactory
.createTemplateLanguageBlock(childNode, createChildWrap(childNode), createChildAlignment(childNode), null, mySettings);
childBlock.setParent(this);
tlChildren.add(childBlock);
}
}
final List<Block> children = (List<Block>)(myForeignChildren == null ? tlChildren : BlockUtil.mergeBlocks(tlChildren, myForeignChildren));
//BlockUtil.printBlocks(getTextRange(), children);
return BlockUtil.setParent(children, this);
}
示例12: buildChildren
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Override
protected List<Block> buildChildren()
{
final ArrayList<Block> result = new ArrayList<>();
ASTNode child = myNode.getFirstChildNode();
Indent currentIndent = getLabelIndent();
Wrap currentWrap = null;
while(child != null)
{
if(!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0)
{
result.add(createJavaBlock(child, mySettings, myJavaSettings, currentIndent, currentWrap, AlignmentStrategy.getNullStrategy()));
if(child.getElementType() == JavaTokenType.COLON)
{
currentIndent = Indent.getNoneIndent();
currentWrap = Wrap.createWrap(WrapType.ALWAYS, true);
}
}
child = child.getTreeNext();
}
return result;
}
示例13: processHeadCommentsAndWhiteSpaces
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
private void processHeadCommentsAndWhiteSpaces(@NotNull List<Block> result)
{
while(myCurrentChild != null)
{
if(StdTokenSets.COMMENT_BIT_SET.contains(myCurrentChild.getElementType()) || myCurrentChild.getElementType() == JavaDocElementType.DOC_COMMENT)
{
Block commentBlock = createJavaBlock(myCurrentChild, mySettings, myJavaSettings, Indent.getNoneIndent(), null, AlignmentStrategy.getNullStrategy());
result.add(commentBlock);
myCurrentIndent = Indent.getNoneIndent();
}
else if(!FormatterUtil.containsWhiteSpacesOnly(myCurrentChild))
{
break;
}
myCurrentOffset += myCurrentChild.getTextLength();
myCurrentChild = myCurrentChild.getTreeNext();
}
}
示例14: collectNodes
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
private static void collectNodes(@NotNull List<ASTNode> nodes, @NotNull ASTNode node)
{
ASTNode child = node.getFirstChildNode();
while(child != null)
{
if(!FormatterUtil.containsWhiteSpacesOnly(child))
{
IElementType type = child.getElementType();
if(type == JavaElementType.METHOD_CALL_EXPRESSION || type == JavaElementType.REFERENCE_EXPRESSION)
{
collectNodes(nodes, child);
}
else
{
nodes.add(child);
}
}
child = child.getTreeNext();
}
}
示例15: processEnumBlock
import com.intellij.psi.formatter.FormatterUtil; //导入方法依赖的package包/类
@Nullable
private ASTNode processEnumBlock(@NotNull List<Block> result, @Nullable ASTNode child, ASTNode last)
{
final WrappingStrategy wrappingStrategy = WrappingStrategy.createDoNotWrapCommaStrategy(Wrap.createWrap(getWrapType(mySettings.ENUM_CONSTANTS_WRAP), true));
while(child != null)
{
if(!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0)
{
result.add(createJavaBlock(child, mySettings, myJavaSettings, Indent.getNormalIndent(), wrappingStrategy.getWrap(child.getElementType()), AlignmentStrategy.getNullStrategy()));
if(child == last)
{
return child;
}
}
child = child.getTreeNext();
}
return null;
}