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


Java Wrap.createWrap方法代码示例

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


在下文中一共展示了Wrap.createWrap方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: BuckBlock

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
public BuckBlock(
    final ASTNode node,
    CodeStyleSettings settings,
    @Nullable final Alignment alignment,
    final Indent indent,
    @Nullable final Wrap wrap) {
  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) {
    myChildWrap = Wrap.createWrap(CommonCodeStyleSettings.WRAP_ALWAYS, true);
  } else {
    myChildWrap = null;
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:BuckBlock.java

示例7: buildChildren

import com.intellij.formatting.Wrap; //导入方法依赖的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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:LabeledJavaBlock.java

示例8: buildBlocks

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
public List<Block> buildBlocks()
{
	final Wrap wrap = Wrap.createWrap(getWrapType(myJavaSettings.ANNOTATION_PARAMETER_WRAP), false);
	final Alignment alignment = myJavaSettings.ALIGN_MULTILINE_ANNOTATION_PARAMETERS ? Alignment.createAlignment() : null;

	ChildrenBlocksBuilder.Config config = new ChildrenBlocksBuilder.Config().setDefaultIndent(Indent.getContinuationWithoutFirstIndent()).setIndent(JavaTokenType.RPARENTH, Indent.getNoneIndent()
	).setIndent(JavaTokenType.LPARENTH, Indent.getNoneIndent())

			.setDefaultWrap(wrap).setNoWrap(JavaTokenType.COMMA).setNoWrap(JavaTokenType.RPARENTH).setNoWrap(JavaTokenType.LPARENTH)

			.setDefaultAlignment(alignment).setNoAlignment(JavaTokenType.COMMA).setNoAlignment(JavaTokenType.LPARENTH).setNoAlignmentIf(JavaTokenType.RPARENTH, node -> {
				PsiElement prev = PsiTreeUtil.skipSiblingsBackward(node.getPsi(), PsiWhiteSpace.class);
				if(prev == null)
				{
					return false;
				}
				return prev instanceof PsiNameValuePair && !PsiTreeUtil.hasErrorElements(prev);
			});

	return config.createBuilder().buildNodeChildBlocks(myNode, myFactory);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:AnnotationInitializerBlocksBuilder.java

示例9: buildBlocks

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
public List<Block> buildBlocks()
{
	Wrap wrap = Wrap.createWrap(getWrapType(mySettings.ARRAY_INITIALIZER_WRAP), false);
	Alignment alignment = mySettings.ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION ? Alignment.createAlignment() : null;

	ChildrenBlocksBuilder.Config config = new ChildrenBlocksBuilder.Config().setDefaultIndent(Indent.getContinuationWithoutFirstIndent()).setIndent(JavaTokenType.RBRACE, Indent.getNoneIndent())
			.setIndent(JavaTokenType.LBRACE, Indent.getNoneIndent())

			.setDefaultWrap(wrap).setNoWrap(JavaTokenType.COMMA).setNoWrap(JavaTokenType.RBRACE).setNoWrap(JavaTokenType.LBRACE)

			.setDefaultAlignment(alignment).setNoAlignment(JavaTokenType.COMMA).setNoAlignment(JavaTokenType.LBRACE).setNoAlignmentIf(JavaTokenType.RBRACE, node -> {
				PsiElement prev = PsiTreeUtil.skipSiblingsBackward(node.getPsi(), PsiWhiteSpace.class);
				if(prev == null)
				{
					return false;
				}
				return prev.getNode().getElementType() != JavaTokenType.COMMA;
			});

	return config.createBuilder().buildNodeChildBlocks(myNode, myBlockFactory);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:ArrayInitializerBlocksBuilder.java

示例10: createModel

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
    PsiFile containingFile = element.getContainingFile().getViewProvider().getPsi(ProtoLanguage.INSTANCE);
    ASTNode fileNode = containingFile.getNode();
    Wrap wrap = Wrap.createWrap(WrapType.NONE, false);
    Alignment alignment = Alignment.createAlignment();
    ProtoFileBlock block = new ProtoFileBlock(fileNode, wrap, alignment, settings);
    return FormattingModelProvider.createFormattingModelForPsiFile(containingFile, block, settings);
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:11,代码来源:FormattingModelBuilder.java

示例11: createModel

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
@NotNull
@Override
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {

    final com.amazon.ion.plugin.intellij.formatting.IonBlock rootBlock = new com.amazon.ion.plugin.intellij.formatting.IonBlock(element.getNode(),
            Wrap.createWrap(WrapType.NONE, false),
            Alignment.createAlignment(true),
            createSpaceBuilder(settings), settings);

    return FormattingModelProvider.createFormattingModelForPsiFile(
            element.getContainingFile(),
            rootBlock, settings);
}
 
开发者ID:amzn,项目名称:ion-intellij-plugin,代码行数:14,代码来源:IonFormattingModelBuilder.java

示例12: createCallChunkWrap

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
private Wrap createCallChunkWrap(int chunkIndex, @NotNull List<ChainedCallChunk> methodCall) {
  if (mySettings.WRAP_FIRST_METHOD_IN_CALL_CHAIN) {
    ChainedCallChunk next = chunkIndex + 1 < methodCall.size() ? methodCall.get(chunkIndex + 1) : null;
    if (next != null && isMethodCall(next)) {
      return Wrap.createWrap(getWrapType(mySettings.METHOD_CALL_CHAIN_WRAP), true);
    }
  }

  return Wrap.createWrap(getWrapType(mySettings.METHOD_CALL_CHAIN_WRAP), false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ChainMethodCallsBlockBuilder.java

示例13: buildBlocks

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
public List<Block> buildBlocks() {
  final Wrap wrap = Wrap.createWrap(getWrapType(myJavaSettings.ANNOTATION_PARAMETER_WRAP), false);
  final Alignment alignment = myJavaSettings.ALIGN_MULTILINE_ANNOTATION_PARAMETERS ? Alignment.createAlignment() : null;

  ChildrenBlocksBuilder.Config config = new ChildrenBlocksBuilder.Config()
    .setDefaultIndent(Indent.getContinuationWithoutFirstIndent())
    .setIndent(JavaTokenType.RPARENTH, Indent.getNoneIndent())
    .setIndent(JavaTokenType.LPARENTH, Indent.getNoneIndent())

    .setDefaultWrap(wrap)
    .setNoWrap(JavaTokenType.COMMA)
    .setNoWrap(JavaTokenType.RPARENTH)
    .setNoWrap(JavaTokenType.LPARENTH)

    .setDefaultAlignment(alignment)
    .setNoAlignment(JavaTokenType.COMMA)
    .setNoAlignment(JavaTokenType.LPARENTH)
    .setNoAlignmentIf(JavaTokenType.RPARENTH, new Condition<ASTNode>() {
      @Override
      public boolean value(ASTNode node) {
        PsiElement prev = PsiTreeUtil.skipSiblingsBackward(node.getPsi(), PsiWhiteSpace.class);
        if (prev == null) return false;
        return prev instanceof PsiNameValuePair && !PsiTreeUtil.hasErrorElements(prev);
      }
    });

  return config.createBuilder().buildNodeChildBlocks(myNode, myFactory);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AnnotationInitializerBlocksBuilder.java

示例14: buildBlocks

import com.intellij.formatting.Wrap; //导入方法依赖的package包/类
public List<Block> buildBlocks() {
  Wrap wrap = Wrap.createWrap(getWrapType(mySettings.ARRAY_INITIALIZER_WRAP), false);
  Alignment alignment = mySettings.ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION ? Alignment.createAlignment() : null;

  ChildrenBlocksBuilder.Config config = new ChildrenBlocksBuilder.Config()
    .setDefaultIndent(Indent.getContinuationWithoutFirstIndent())
    .setIndent(JavaTokenType.RBRACE, Indent.getNoneIndent())
    .setIndent(JavaTokenType.LBRACE, Indent.getNoneIndent())

    .setDefaultWrap(wrap)
    .setNoWrap(JavaTokenType.COMMA)
    .setNoWrap(JavaTokenType.RBRACE)
    .setNoWrap(JavaTokenType.LBRACE)

    .setDefaultAlignment(alignment)
    .setNoAlignment(JavaTokenType.COMMA)
    .setNoAlignment(JavaTokenType.LBRACE)
    .setNoAlignmentIf(JavaTokenType.RBRACE, new Condition<ASTNode>() {
      @Override
      public boolean value(ASTNode node) {
        PsiElement prev = PsiTreeUtil.skipSiblingsBackward(node.getPsi(), PsiWhiteSpace.class);
        if (prev == null) return false;
        return prev.getNode().getElementType() != JavaTokenType.COMMA;
      }
    });

  return config.createBuilder().buildNodeChildBlocks(myNode, myBlockFactory);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ArrayInitializerBlocksBuilder.java

示例15: 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) {
        if (child.getElementType() != TokenType.WHITE_SPACE && child.getTextRange().getLength() != 0) {
            Block block = new XQueryFormattingBlock(child, Wrap.createWrap(WrapType.NONE, false), null, settings,
                    spacingBuilder);
            blocks.add(block);
        }
        child = child.getTreeNext();
    }
    return blocks;
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:15,代码来源:XQueryFormattingBlock.java


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