• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ChildAttributes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	if(myNode.getElementType() == JavaElementType.CONDITIONAL_EXPRESSION && mySettings.ALIGN_MULTILINE_TERNARY_OPERATION)
	{
		final Alignment usedAlignment = getUsedAlignment(newChildIndex);
		if(usedAlignment != null)
		{
			return new ChildAttributes(null, usedAlignment);
		}
		else
		{
			return super.getChildAttributes(newChildIndex);
		}
	}
	else if(myNode.getElementType() == JavaElementType.SWITCH_LABEL_STATEMENT)
	{
		return new ChildAttributes(Indent.getNormalIndent(), null);
	}
	else
	{
		return super.getChildAttributes(newChildIndex);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:SimpleJavaBlock.java


示例2: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	if(isAfter(newChildIndex, new IElementType[]{
			JavaDocElementType.DOC_COMMENT,
			JavaElementType.MODIFIER_LIST
	}))
	{
		return new ChildAttributes(Indent.getNoneIndent(), null);
	}
	else
	{
		if(getSubBlocks().size() == newChildIndex)
		{
			return new ChildAttributes(Indent.getNoneIndent(), null);
		}
		else
		{
			return new ChildAttributes(getCodeBlockInternalIndent(myChildrenIndent), null);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:CodeBlockBlock.java


示例3: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
  if (hasElementType(myNode, BUCK_CONTAINERS)) {
    return new ChildAttributes(Indent.getNormalIndent(), null);
  } else if (myNode.getPsi() instanceof PsiFile) {
    return new ChildAttributes(Indent.getNoneIndent(), null);
  } else {
    return new ChildAttributes(null, null);
  }
}
 
开发者ID:wangyanxing,项目名称:Buck-IntelliJ-Plugin,代码行数:12,代码来源:BuckBlock.java


示例4: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
    IElementType type = myNode.getElementType();
    Indent childIndent = calculateChildIndent(type, false);
    if (childIndent == null && newChildIndex > 0) {
        IElementType calculatedType = getIElementType(newChildIndex);
        childIndent = calculateChildIndent(calculatedType, true);
    }
    return new ChildAttributes(childIndent != null ? childIndent : Indent.getNoneIndent(), null);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:12,代码来源:XQueryFormattingBlock.java


示例5: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
  if (hasElementType(myNode, BUCK_CONTAINERS)) {
    return new ChildAttributes(Indent.getNormalIndent(), null);
  } else if (myNode.getPsi() instanceof PsiFile) {
    return new ChildAttributes(Indent.getNoneIndent(), null);
  } else {
    return new ChildAttributes(null, null);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:11,代码来源:BuckBlock.java


示例6: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	if(myChildAttributes != null)
	{
		return myChildAttributes;
	}
	else
	{
		Alignment alignment = null;
		if(mySubBlocks.size() > newChildIndex)
		{
			Block block = mySubBlocks.get(newChildIndex);
			alignment = block.getAlignment();
		}
		else if(mySubBlocks.size() == newChildIndex)
		{
			if(isRParenth(getRightMostBlock()))
			{
				alignment = getDotAlignment();
			}
		}

		return new ChildAttributes(getIndent(), alignment);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:28,代码来源:SyntheticCodeBlock.java


示例7: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	if(myUseChildAttributes)
	{
		return new ChildAttributes(myChildIndent, myChildAlignment);
	}
	if(isAfter(newChildIndex, new IElementType[]{JavaDocElementType.DOC_COMMENT}))
	{
		return new ChildAttributes(Indent.getNoneIndent(), myChildAlignment);
	}
	return super.getChildAttributes(newChildIndex);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:AbstractJavaBlock.java


示例8: createCodeBlockBlock

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
public SyntheticCodeBlock createCodeBlockBlock(final List<Block> localResult, final Indent indent, final int childrenIndent)
{
	final SyntheticCodeBlock result = new SyntheticCodeBlock(localResult, null, getSettings(), myJavaSettings, indent, null);
	result.setChildAttributes(new ChildAttributes(getCodeBlockInternalIndent(childrenIndent), null));
	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:AbstractJavaBlock.java


示例9: createCaseSectionBlock

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
private SyntheticCodeBlock createCaseSectionBlock(final List<Block> localResult, final Alignment childAlignment, final Indent indent, final Wrap childWrap)
{
	final SyntheticCodeBlock result = new SyntheticCodeBlock(localResult, childAlignment, getSettings(), myJavaSettings, indent, childWrap)
	{
		@Override
		@NotNull
		public ChildAttributes getChildAttributes(final int newChildIndex)
		{
			IElementType prevElementType = null;
			if(newChildIndex > 0)
			{
				final Block previousBlock = getSubBlocks().get(newChildIndex - 1);
				if(previousBlock instanceof AbstractBlock)
				{
					prevElementType = ((AbstractBlock) previousBlock).getNode().getElementType();
				}
			}

			if(prevElementType == JavaElementType.BLOCK_STATEMENT || prevElementType == JavaElementType.BREAK_STATEMENT || prevElementType == JavaElementType.RETURN_STATEMENT)
			{
				return new ChildAttributes(Indent.getNoneIndent(), null);
			}
			else
			{
				return super.getChildAttributes(newChildIndex);
			}
		}

	};
	result.setChildAttributes(new ChildAttributes(Indent.getNormalIndent(), null));
	result.setIsIncomplete(true);
	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:34,代码来源:CodeBlockBlock.java


示例10: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
    return new ChildAttributes(getChildIndent(), childAlignment);
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:6,代码来源:ParentBlock.java


示例11: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex) {
    return new ChildAttributes(getIndent(), null);
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:6,代码来源:LeafBlock.java


示例12: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex) {
  return myInjectedBlock.getChildAttributes(newChildIndex);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:AnotherLanguageBlockWrapper.java


示例13: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
  return new ChildAttributes(Indent.getNormalIndent(), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ClosureBodyBlock.java


示例14: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex) {
  return myInjectedBlock.getChildAttributes(newChildIndex);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:AnotherLanguageBlockWrapper.java


示例15: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex)
{
	return new ChildAttributes(null, null);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:7,代码来源:CSharpDisabledFormattingBlock.java


示例16: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	Indent indent = null;
	final IElementType blockElementType = myNode.getElementType();

	if(blockElementType == JSTokenTypes.DOC_COMMENT)
	{
		return new ChildAttributes(Indent.getSpaceIndent(1), null);
	}

	if(blockElementType == JSElementTypes.PACKAGE_STATEMENT)
	{
		final JSCodeStyleSettings customSettings = CodeStyleSettingsManager.getSettings(myNode.getPsi().getProject()).getCustomSettings
				(JSCodeStyleSettings.class);
		if(customSettings.INDENT_PACKAGE_CHILDREN == JSCodeStyleSettings.INDENT)
		{
			indent = Indent.getNormalIndent();
		}
		else
		{
			indent = Indent.getNoneIndent();
		}
	}
	else if(blockElementType == JSElementTypes.BLOCK_STATEMENT ||
			blockElementType == JSElementTypes.CLASS ||
			blockElementType == JSElementTypes.OBJECT_LITERAL_EXPRESSION)
	{
		indent = Indent.getNormalIndent();
	}
	else if(blockElementType instanceof JSFileElementType || blockElementType == JSElementTypes.EMBEDDED_CONTENT)
	{
		indent = Indent.getNoneIndent();
	}
	else if(JSElementTypes.SOURCE_ELEMENTS.contains(blockElementType) ||
			blockElementType == JSElementTypes.FUNCTION_EXPRESSION ||
			blockElementType == JSElementTypes.ATTRIBUTE_LIST)
	{
		indent = Indent.getNoneIndent();
	}

	Alignment alignment = null;
	final List<Block> subBlocks = getSubBlocks();
	for(int i = 0; i < newChildIndex; i++)
	{
		if(i == subBlocks.size())
		{
			break;
		}
		final Alignment childAlignment = subBlocks.get(i).getAlignment();
		if(childAlignment != null)
		{
			alignment = childAlignment;
			break;
		}
	}

	// in for loops, alignment is required only for items within parentheses
	if(blockElementType == JSElementTypes.FOR_STATEMENT || blockElementType == JSElementTypes.FOR_IN_STATEMENT)
	{
		for(int i = 0; i < newChildIndex; i++)
		{
			if(((JSBlock) subBlocks.get(i)).getNode().getElementType() == JSTokenTypes.RPAR)
			{
				alignment = null;
				break;
			}
		}
	}

	return new ChildAttributes(indent, alignment);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:74,代码来源:JSBlock.java


示例17: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:7,代码来源:JSDocCommentBlock.java


示例18: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	return new ChildAttributes(Indent.getNoneIndent(), null);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:LabeledJavaBlock.java


示例19: setChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
public void setChildAttributes(final ChildAttributes childAttributes)
{
	myChildAttributes = childAttributes;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:5,代码来源:SyntheticCodeBlock.java


示例20: getChildAttributes

import com.intellij.formatting.ChildAttributes; //导入依赖的package包/类
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex)
{
	return ChildAttributes.DELEGATE_TO_NEXT_CHILD;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:ReadonlyWhitespaceBlock.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextHeader类代码示例发布时间:2022-05-22
下一篇:
Java MvcEndpoint类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap