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


Java Wrap类代码示例

本文整理汇总了Java中com.intellij.formatting.Wrap的典型用法代码示例。如果您正苦于以下问题:Java Wrap类的具体用法?Java Wrap怎么用?Java Wrap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildChildren

import com.intellij.formatting.Wrap; //导入依赖的package包/类
@Override
protected List<Block> buildChildren() {
    List<Block> blocks = new ArrayList<>();
    ASTNode child = myNode.getFirstChildNode();
    while (child != null) {
        if (child.getElementType() != TokenType.WHITE_SPACE) {

            Block block = new FlexibleSearchBlock(
                child,
                Wrap.createWrap(WrapType.NONE, false),
                null,
                spacingBuilder
            );

            blocks.add(block);
        }
        child = child.getTreeNext();
    }
    return blocks;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:FlexibleSearchBlock.java

示例2: generateForBinaryExpr

import com.intellij.formatting.Wrap; //导入依赖的package包/类
/**
 * Generates blocks for binary expressions
 *
 * @param node
 * @return
 */
private static List<Block> generateForBinaryExpr(final ASTNode node, Wrap myWrap, CodeStyleSettings mySettings) {
    final ArrayList<Block> subBlocks = new ArrayList<Block>();
    Alignment alignment = mySettings.ALIGN_MULTILINE_BINARY_OPERATION ? Alignment.createAlignment() : null;
    LuaBinaryExpression myExpr = (LuaBinaryExpression) node.getPsi();
    ASTNode[] children = node.getChildren(null);
    if (myExpr.getLeftExpression() instanceof LuaBinaryExpression) {
        addBinaryChildrenRecursively(myExpr.getLeftExpression(), subBlocks, Indent.getContinuationWithoutFirstIndent(), alignment, myWrap, mySettings);
    }
    for (ASTNode childNode : children) {
        if (canBeCorrectBlock(childNode) &&
                !(childNode.getPsi() instanceof LuaBinaryExpression)) {
            subBlocks.add(new LuaFormattingBlock(childNode, alignment, Indent.getContinuationWithoutFirstIndent(), myWrap, mySettings));
        }
    }
    if (myExpr.getRightExpression() instanceof LuaBinaryExpression) {
        addBinaryChildrenRecursively(myExpr.getRightExpression(), subBlocks, Indent.getContinuationWithoutFirstIndent(), alignment, myWrap, mySettings);
    }
    return subBlocks;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:26,代码来源:LuaBlockGenerator.java

示例3: addBinaryChildrenRecursively

import com.intellij.formatting.Wrap; //导入依赖的package包/类
/**
 * Adds all children of specified element to given list
 *
 * @param elem
 * @param list
 * @param indent
 * @param alignment
 */
private static void addBinaryChildrenRecursively(PsiElement elem,
                                                 List<Block> list,
                                                 Indent indent,
                                                 Alignment alignment, Wrap myWrap, CodeStyleSettings mySettings) {
    if (elem == null) return;
    ASTNode[] children = elem.getNode().getChildren(null);
    // For binary expressions
    if ((elem instanceof LuaBinaryExpression)) {
        LuaBinaryExpression myExpr = ((LuaBinaryExpression) elem);
        if (myExpr.getLeftExpression() instanceof LuaBinaryExpression) {
            addBinaryChildrenRecursively(myExpr.getLeftExpression(), list, Indent.getContinuationWithoutFirstIndent(), alignment, myWrap, mySettings);
        }
        for (ASTNode childNode : children) {
            if (canBeCorrectBlock(childNode) &&
                    !(childNode.getPsi() instanceof LuaBinaryExpression)) {
                list.add(new LuaFormattingBlock(childNode, alignment, indent, myWrap, mySettings));
            }
        }
        if (myExpr.getRightExpression() instanceof LuaBinaryExpression) {
            addBinaryChildrenRecursively(myExpr.getRightExpression(), list, Indent.getContinuationWithoutFirstIndent(), alignment, myWrap, mySettings);
        }
    }
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:32,代码来源:LuaBlockGenerator.java

示例4: generateForNestedExpr

import com.intellij.formatting.Wrap; //导入依赖的package包/类
/**
 * Generates blocks for nested expressions like a.b.c etc.
 *
 * @param node
 * @return
 */
private static List<Block> generateForNestedExpr(final ASTNode node, Alignment myAlignment, Wrap myWrap, CodeStyleSettings mySettings) {
    final ArrayList<Block> subBlocks = new ArrayList<Block>();
    ASTNode children[] = node.getChildren(null);
    if (children.length > 0 && false /* NESTED.contains(children[0].getElementType()) */) {
        addNestedChildrenRecursively(children[0].getPsi(), subBlocks, myAlignment, myWrap, mySettings);
    } else if (canBeCorrectBlock(children[0])) {
        subBlocks.add(new LuaFormattingBlock(children[0], myAlignment, Indent.getContinuationWithoutFirstIndent(), myWrap, mySettings));
    }
    if (children.length > 1) {
        for (ASTNode childNode : children) {
            if (canBeCorrectBlock(childNode) &&
                    children[0] != childNode) {
                subBlocks.add(new LuaFormattingBlock(childNode, myAlignment, Indent.getContinuationWithoutFirstIndent(), myWrap, mySettings));
            }
        }
    }
    return subBlocks;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:25,代码来源:LuaBlockGenerator.java

示例5: addNestedChildrenRecursively

import com.intellij.formatting.Wrap; //导入依赖的package包/类
/**
 * Adds nested children for paths
 *
 * @param elem
 * @param list
 * @param myAlignment
 * @param mySettings
 */
private static void addNestedChildrenRecursively(PsiElement elem,
                                                 List<Block> list, Alignment myAlignment, Wrap myWrap, CodeStyleSettings mySettings) {
    ASTNode[] children = elem.getNode().getChildren(null);
    // For path expressions
    if (children.length > 0) {
        addNestedChildrenRecursively(children[0].getPsi(), list, myAlignment, myWrap, mySettings);
    } else if (canBeCorrectBlock(children[0])) {
        list.add(new LuaFormattingBlock(children[0], myAlignment, Indent.getContinuationWithoutFirstIndent(), myWrap, mySettings));
    }
    if (children.length > 1) {
        for (ASTNode childNode : children) {
            if (canBeCorrectBlock(childNode) &&
                    children[0] != childNode) {
                if (elem.getNode() != null) {
                    list.add(new LuaFormattingBlock(childNode, myAlignment, Indent.getContinuationWithoutFirstIndent(), myWrap, mySettings));
                } else {
                    list.add(new LuaFormattingBlock(childNode, myAlignment, Indent.getNoneIndent(), myWrap, mySettings));
                }
            }
        }
    }
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:31,代码来源:LuaBlockGenerator.java

示例6: buildChildren

import com.intellij.formatting.Wrap; //导入依赖的package包/类
@SuppressWarnings("ConstantConditions")
@Override
protected List<Block> buildChildren() {
    List<Block> blocks = new ArrayList<Block>();
    if (myNode.getElementType() == STRUCT) {
        goDeep(blocks, myNode, myAlignment, Alignment.createAlignment(), false, pairContainers);
    } else if (myNode.getElementType() == ARRAY) {
        goDeep(blocks, myNode, myAlignment, Alignment.createAlignment(), false, arrayContainers);
    } else if (myNode.getElementType() == EXPRESSION) {
        goDeep(blocks, myNode, myAlignment, Alignment.createAlignment(), false, expressionContainers);
    } else {

        ASTNode child = myNode.getFirstChildNode();
        while (child != null) {
            if (child.getElementType() != TokenType.WHITE_SPACE) {
                Block block = new IonBlock(child, Wrap.createWrap(WrapType.NORMAL, false), myAlignment, spacingBuilder, settings);
                blocks.add(block);
            }
            child = child.getTreeNext();
        }
    }
    return blocks;
}
 
开发者ID:amzn,项目名称:ion-intellij-plugin,代码行数:24,代码来源:IonBlock.java

示例7: buildNodeChildBlocks

import com.intellij.formatting.Wrap; //导入依赖的package包/类
public List<Block> buildNodeChildBlocks(ASTNode node, BlockFactory factory) {
  List<Block> blocks = ContainerUtil.newArrayList();

  for (ASTNode child : node.getChildren(null)) {
    if (FormatterUtil.isWhitespaceOrEmpty(child) || child.getTextLength() == 0) {
        continue;
    }

    Alignment alignment = myConfig.getAlignment(child);

    IElementType type = child.getElementType();
    Indent indent = myConfig.getIndent(type);
    Wrap wrap = myConfig.getWrap(type);

    blocks.add(factory.createBlock(child, indent, alignment, wrap));
  }

  return blocks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ChildrenBlocksBuilder.java

示例8: create

import com.intellij.formatting.Wrap; //导入依赖的package包/类
@NotNull
public Block create(@NotNull final List<ASTNode> subNodes, final Wrap wrap, @Nullable final Alignment alignment) {
  final ArrayList<Block> subBlocks = new ArrayList<Block>();
  final ASTNode firstNode = subNodes.get(0);
  if (firstNode.getElementType() == JavaTokenType.DOT) {
    AlignmentStrategy strategy = AlignmentStrategy.getNullStrategy();
    Block block = newJavaBlock(firstNode, mySettings, myJavaSettings, Indent.getNoneIndent(), null, strategy);
    subBlocks.add(block);
    subNodes.remove(0);
    if (!subNodes.isEmpty()) {
      subBlocks.add(create(subNodes, wrap, null));
    }
    return new SyntheticCodeBlock(subBlocks, alignment, mySettings, myJavaSettings, Indent.getContinuationIndent(myIndentSettings.USE_RELATIVE_INDENTS), wrap);
  }
  return new SyntheticCodeBlock(createJavaBlocks(subNodes), alignment, mySettings, myJavaSettings, Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CallChunkBlockBuilder.java

示例9: buildChildren

import com.intellij.formatting.Wrap; //导入依赖的package包/类
@Override
protected List<Block> buildChildren() {
    List<Block> blocks = new ArrayList<Block>();

    ASTNode child = myNode.getFirstChildNode();
    while (child != null) {
        IElementType type = child.getElementType();

        if (!TokenType.WHITE_SPACE.equals(type) && !CndTypes.CRLF.equals(type)) {
            Block block = new CndBlock(child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), spacingBuilder);
            blocks.add(block);
        }

        child = child.getTreeNext();
    }
    return blocks;
}
 
开发者ID:Tolc,项目名称:IntelliJ_Jahia_plugin,代码行数:18,代码来源:CndBlock.java

示例10: BuckBlock

import com.intellij.formatting.Wrap; //导入依赖的package包/类
public BuckBlock(@Nullable final BuckBlock parent,
                 @NotNull final ASTNode node,
                 @NotNull CodeStyleSettings settings,
                 @Nullable final Alignment alignment,
                 @NotNull final Indent indent,
                 @Nullable final Wrap wrap) {
  myParent = parent;
  myAlignment = alignment;
  myIndent = indent;
  myNode = node;
  myPsiElement = node.getPsi();
  myWrap = wrap;
  mySettings = settings;

  mySpacingBuilder = BuckFormattingModelBuilder.createSpacingBuilder(settings);

  if (myPsiElement instanceof BuckArrayElements ||
      myPsiElement instanceof BuckRuleBody ||
      myPsiElement instanceof BuckListElements ||
      myPsiElement instanceof BuckObjectElements) {
    myChildWrap = Wrap.createWrap(CommonCodeStyleSettings.WRAP_ALWAYS, true);
  } else {
    myChildWrap = null;
  }
}
 
开发者ID:wangyanxing,项目名称:Buck-IntelliJ-Plugin,代码行数:26,代码来源:BuckBlock.java

示例11: createChildWrap

import com.intellij.formatting.Wrap; //导入依赖的package包/类
private static Wrap createChildWrap(ASTNode child, int parentWrap, boolean newLineAfterLBrace, boolean newLineBeforeRBrace) {
  IElementType childType = child.getElementType();
  if (childType != PLPAREN && childType != PRPAREN) {
    if (FormatterUtil.isPrecededBy(child, PLBRACK)) {
      if (newLineAfterLBrace) {
        return Wrap.createChildWrap(Wrap.createWrap(parentWrap, true), WrapType.ALWAYS, true);
      }
      else {
        return Wrap.createWrap(WrapType.NONE, true);
      }
    }
    return Wrap.createWrap(WrappingUtil.getWrapType(parentWrap), true);
  }
  if (childType == PRBRACK && newLineBeforeRBrace) {
    return Wrap.createWrap(WrapType.ALWAYS, true);
  }
  return Wrap.createWrap(WrapType.NONE, true);
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:19,代码来源:HaxeWrappingProcessor.java

示例12: create

import com.intellij.formatting.Wrap; //导入依赖的package包/类
@NotNull
public Block create(@NotNull final List<ASTNode> subNodes, final Wrap wrap, @Nullable final Alignment alignment)
{
	final ArrayList<Block> subBlocks = new ArrayList<>();
	final ASTNode firstNode = subNodes.get(0);
	if(firstNode.getElementType() == JavaTokenType.DOT)
	{
		AlignmentStrategy strategy = AlignmentStrategy.getNullStrategy();
		Block block = newJavaBlock(firstNode, mySettings, myJavaSettings, Indent.getNoneIndent(), null, strategy);
		subBlocks.add(block);
		subNodes.remove(0);
		if(!subNodes.isEmpty())
		{
			subBlocks.add(create(subNodes, wrap, null));
		}
		return new SyntheticCodeBlock(subBlocks, alignment, mySettings, myJavaSettings, Indent.getContinuationIndent(myIndentSettings.USE_RELATIVE_INDENTS), wrap);
	}
	return new SyntheticCodeBlock(createJavaBlocks(subNodes), alignment, mySettings, myJavaSettings, Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS), null);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:CallChunkBlockBuilder.java

示例13: chooseWrap

import com.intellij.formatting.Wrap; //导入依赖的package包/类
protected Wrap chooseWrap(final ASTNode child, final Wrap tagBeginWrap, final Wrap attrWrap, final Wrap textWrap) {
  if (myNode.getElementType() == XmlElementType.XML_TEXT) return textWrap;
  final IElementType elementType = child.getElementType();
  if (elementType == XmlElementType.XML_ATTRIBUTE) return attrWrap;
  if (elementType == XmlTokenType.XML_START_TAG_START) return tagBeginWrap;
  if (elementType == XmlTokenType.XML_END_TAG_START) {
    final PsiElement parent = SourceTreeToPsiMap.treeElementToPsi(child.getTreeParent());
    if (parent instanceof XmlTag) {
      final XmlTag tag = (XmlTag)parent;
      if (canWrapTagEnd(tag)) {
        return getTagEndWrapping(tag);
      }
    }
    return null;
  }
  if (elementType == XmlElementType.XML_TEXT || elementType == XmlTokenType.XML_DATA_CHARACTERS) return textWrap;
  return null;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:19,代码来源:AbstractXmlBlock.java

示例14: processAllChildrenFrom

import com.intellij.formatting.Wrap; //导入依赖的package包/类
private ASTNode processAllChildrenFrom(final List<Block> result,
                                       final @NotNull ASTNode child,
                                       final Wrap wrap,
                                       final Alignment alignment,
                                       final Indent indent) {
  ASTNode resultNode = child;
  ASTNode currentChild = child.getTreeNext();
  while (currentChild != null && currentChild.getElementType() != XmlTokenType.XML_END_TAG_START) {
    if (!containsWhiteSpacesOnly(currentChild)) {
      currentChild = processChild(result, currentChild, wrap, alignment, indent);
      resultNode = currentChild;
    }
    if (currentChild != null) {
      currentChild = currentChild.getTreeNext();
    }
  }
  return resultNode;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:19,代码来源:AbstractXmlBlock.java

示例15: processSimpleChild

import com.intellij.formatting.Wrap; //导入依赖的package包/类
protected void processSimpleChild(final ASTNode child,
                                final Indent indent,
                                final List<Block> result,
                                final Wrap wrap,
                                final Alignment alignment) {
  if (isXmlTag(child)) {
    result.add(createTagBlock(child, indent != null ? indent : Indent.getNoneIndent(), wrap, alignment));
  } else if (child.getElementType() == XmlElementType.XML_DOCTYPE) {
    result.add(
      new XmlBlock(child, wrap, alignment, myXmlFormattingPolicy, indent, null, isPreserveSpace()) {
        protected Wrap getDefaultWrap(final ASTNode node) {
          final IElementType type = node.getElementType();
          return type == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN
                 ? Wrap.createWrap(getWrapType(myXmlFormattingPolicy.getAttributesWrap()), false) : null;
        }
      }
    );
  }
  else {
    result.add(createSimpleChild(child, indent, wrap, alignment));
  }
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:23,代码来源:AbstractXmlBlock.java


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