本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}