本文整理汇总了Java中com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper类的典型用法代码示例。如果您正苦于以下问题:Java DataLanguageBlockWrapper类的具体用法?Java DataLanguageBlockWrapper怎么用?Java DataLanguageBlockWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataLanguageBlockWrapper类属于com.intellij.formatting.templateLanguages包,在下文中一共展示了DataLanguageBlockWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
String name = myBlock.getClass().getSimpleName();
if (myBlock instanceof DataLanguageBlockWrapper) {
name += " (" + ((DataLanguageBlockWrapper)myBlock).getOriginal().getClass().getSimpleName() + ")";
}
presentation.addText(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (myBlock.getIndent() != null) {
presentation.addText(" " + String.valueOf(myBlock.getIndent()).replaceAll("[<>]", " "), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
else {
presentation.addText(" Indent: null", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
if (myBlock.getAlignment() != null) {
presentation
.addText(" " + String.valueOf(myBlock.getAlignment()), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.darkGray));
}
if (myBlock.getWrap() != null) {
presentation
.addText(" " + String.valueOf(myBlock.getWrap()), new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, PlatformColors.BLUE));
}
}
示例2: update
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
String name = myBlock.getClass().getSimpleName();
if (myBlock instanceof DataLanguageBlockWrapper) {
name += " (" + ((DataLanguageBlockWrapper)myBlock).getOriginal().getClass().getSimpleName() + ")";
}
presentation.addText(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (myBlock.getIndent() != null) {
presentation.addText(" " + String.valueOf(myBlock.getIndent()).replaceAll("[<>]", " "), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
else {
presentation.addText(" Indent: null", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
if (myBlock.getAlignment() != null) {
presentation
.addText(" " + String.valueOf(myBlock.getAlignment()), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, Color.darkGray));
}
if (myBlock.getWrap() != null) {
presentation
.addText(" " + String.valueOf(myBlock.getWrap()), new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, PlatformColors.BLUE));
}
}
示例3: getChildAttributes
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
/**
* TODO if/when we implement alignment, update this method to do alignment properly
*
* This method handles indent and alignment on Enter.
*/
@NotNull
@Override
public ChildAttributes getChildAttributes(int newChildIndex) {
/**
* We indent if we're in a TAG_BLOCK (note that this works nicely since Enter can only be invoked
* INSIDE a block (i.e. after the open block).
*
* Also indent if we are wrapped in a block created by the templated language
*/
if (myNode.getElementType() == DustTypes.TAG_BLOCK
|| (getParent() instanceof DataLanguageBlockWrapper
&& (myNode.getElementType() != DustTypes.STATEMENTS || myNode.getTreeNext() instanceof PsiErrorElement))) {
return new ChildAttributes(Indent.getNormalIndent(), null);
} else {
return new ChildAttributes(Indent.getNoneIndent(), null);
}
}
示例4: createTemplateLanguageBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
@Override
public TemplateLanguageBlock createTemplateLanguageBlock(
@NotNull ASTNode node,
@Nullable Wrap wrap,
@Nullable Alignment alignment,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
@NotNull CodeStyleSettings codeStyleSettings) {
final FormattingDocumentModelImpl documentModel =
FormattingDocumentModelImpl.createOn(node.getPsi().getContainingFile());
if (node.getPsi() instanceof TagElement) {
return new SoyTagBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
} else if(node.getPsi() instanceof TagBlockElement) {
return new SoyTagBlockBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
} else if (node.getPsi() instanceof SoyStatementList) {
return new SoyStatementListBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
} else {
return new SoyBlock(
this,
codeStyleSettings,
node,
foreignChildren,
new HtmlPolicy(codeStyleSettings, documentModel));
}
}
示例5: SoyStatementListBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
public SoyStatementListBlock(
@NotNull TemplateLanguageBlockFactory blockFactory,
@NotNull CodeStyleSettings settings,
@NotNull ASTNode node,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
HtmlPolicy htmlPolicy) {
super(blockFactory, settings, node, foreignChildren, htmlPolicy);
}
示例6: SoyBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
public SoyBlock(
@NotNull TemplateLanguageBlockFactory blockFactory,
@NotNull CodeStyleSettings settings,
@NotNull ASTNode node,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
HtmlPolicy htmlPolicy) {
super(blockFactory, settings, node, foreignChildren);
myHtmlPolicy = htmlPolicy;
}
示例7: hasIndentingForeignBlockParent
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
private boolean hasIndentingForeignBlockParent() {
BlockWithParent parent = getParent();
while (parent instanceof DataLanguageBlockWrapper) {
if (!isSynthetic(parent)) {
ASTNode foreignNode = ((DataLanguageBlockWrapper) parent).getNode();
// Returning false if it is an XmlTag that doesn't force indentation.
return !(foreignNode instanceof XmlTag)
|| myHtmlPolicy.indentChildrenOf((XmlTag) foreignNode);
}
parent = parent.getParent();
}
return false;
}
示例8: SoyTagBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
public SoyTagBlock(
@NotNull TemplateLanguageBlockFactory blockFactory,
@NotNull CodeStyleSettings settings,
@NotNull ASTNode node,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
HtmlPolicy htmlPolicy) {
super(blockFactory, settings, node, foreignChildren, htmlPolicy);
}
示例9: SoyTagBlockBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
public SoyTagBlockBlock(
@NotNull TemplateLanguageBlockFactory blockFactory,
@NotNull CodeStyleSettings settings,
@NotNull ASTNode node,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
HtmlPolicy htmlPolicy) {
super(blockFactory, settings, node, foreignChildren, htmlPolicy);
}
示例10: getIndent
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
@Override
public Indent getIndent() {
// ignore whitespace
if (myNode.getText().trim().length() == 0) {
return Indent.getNoneIndent();
}
if (DustPsiUtil.isNonRootStatementsElement(myNode.getPsi())) {
// we're computing the indent for a non-root STATEMENTS:
// if it's not contained in a foreign block, indent!
if (hasOnlyDustLanguageParents()) {
return Indent.getNormalIndent();
}
}
if (myNode.getTreeParent() != null
&& DustPsiUtil.isNonRootStatementsElement(myNode.getTreeParent().getPsi())) {
// we're computing the indent for a direct descendant of a non-root STATEMENTS:
// if its Block parent (i.e. not DUST AST Tree parent) is a DustForamtterBlock
// which has NOT been indented, then have the element provide the indent itself
if (getParent() instanceof DustFormatterBlock
&& ((DustFormatterBlock) getParent()).getIndent() == Indent.getNoneIndent()) {
return Indent.getNormalIndent();
}
}
// any element that is the direct descendant of a foreign block gets an indent
if (getRealBlockParent() instanceof DataLanguageBlockWrapper) {
return Indent.getNormalIndent();
}
return Indent.getNoneIndent();
}
示例11: getRealBlockParent
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
private BlockWithParent getRealBlockParent() {
// if we can follow the chain of synthetic parent blocks, and if we end up
// at a real DataLanguage block (i.e. the synthetic blocks didn't lead to an DustFormatterBlock),
// we're a child of a templated language node and need an indent
BlockWithParent parent = getParent();
while (parent instanceof DataLanguageBlockWrapper
&& ((DataLanguageBlockWrapper) parent).getOriginal() instanceof SyntheticBlock) {
parent = parent.getParent();
}
return parent;
}
示例12: createTemplateLanguageBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
@Override
public TemplateLanguageBlock createTemplateLanguageBlock(@NotNull ASTNode node,
@Nullable Wrap wrap,
@Nullable Alignment alignment,
@Nullable List<DataLanguageBlockWrapper> foreignChildren,
@NotNull CodeStyleSettings codeStyleSettings) {
return new DustFormatterBlock(this, codeStyleSettings, node, foreignChildren);
}
示例13: isSynthetic
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
private static boolean isSynthetic(BlockWithParent block) {
return block instanceof DataLanguageBlockWrapper && ((DataLanguageBlockWrapper) block)
.getOriginal() instanceof SyntheticBlock;
}
示例14: isXMLTagBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
private static boolean isXMLTagBlock(BlockWithParent block) {
return block instanceof DataLanguageBlockWrapper && ((DataLanguageBlockWrapper) block)
.getNode() instanceof XmlTag;
}
示例15: PlayBaseTemplateBlock
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper; //导入依赖的package包/类
protected PlayBaseTemplateBlock(@NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, @NotNull TemplateLanguageBlockFactory blockFactory, @NotNull CodeStyleSettings settings, @Nullable List<DataLanguageBlockWrapper> foreignChildren)
{
super(node, wrap, alignment, blockFactory, settings, foreignChildren);
}