本文整理匯總了Java中com.intellij.lang.ASTNode.getElementType方法的典型用法代碼示例。如果您正苦於以下問題:Java ASTNode.getElementType方法的具體用法?Java ASTNode.getElementType怎麽用?Java ASTNode.getElementType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.lang.ASTNode
的用法示例。
在下文中一共展示了ASTNode.getElementType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createColumnInfoMap
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static Map<Integer, CsvColumnInfo<ASTNode>> createColumnInfoMap(ASTNode root, CodeStyleSettings settings) {
Map<Integer, CsvColumnInfo<ASTNode>> columnInfoMap = new HashMap<>();
ASTNode child = root.getFirstChildNode();
while (child != null) {
if (child.getElementType() == CsvTypes.RECORD) {
Integer column = 0;
ASTNode subChild = child.getFirstChildNode();
while (subChild != null) {
if (subChild.getElementType() == CsvTypes.FIELD) {
int length = getTextLength(subChild, settings);
if (!columnInfoMap.containsKey(column)) {
columnInfoMap.put(column, new CsvColumnInfo(column, length));
} else if (columnInfoMap.get(column).getMaxLength() < length) {
columnInfoMap.get(column).setMaxLength(length);
}
columnInfoMap.get(column).addElement(subChild);
++column;
}
subChild = subChild.getTreeNext();
}
}
child = child.getTreeNext();
}
return columnInfoMap;
}
示例2: appendDescriptors
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
private void appendDescriptors(final ASTNode node, final Document document, final List<FoldingDescriptor> descriptors) {
if (node.getElementType() == GCMTypes.CLASS_DECLARATION || node.getElementType() == GCMTypes.CUSTOM_TYPE_DECLARATION) {
TextRange fullRange = node.getTextRange();
if (fullRange.getEndOffset() - fullRange.getStartOffset() > 0) {
try {
int startOffset = fullRange.getStartOffset() + document.getText(fullRange).indexOf("{") + 1;
int endOffset = fullRange.getEndOffset() - 1;
if (startOffset < endOffset) {
TextRange shortRange = new TextRange(startOffset, fullRange.getEndOffset() - 1);
if (shortRange.getEndOffset() - shortRange.getStartOffset() > 1) {
descriptors.add(new FoldingDescriptor(node, shortRange));
}
}
} catch (Throwable e) {
}
}
}
ASTNode child = node.getFirstChildNode();
while (child != null) {
appendDescriptors(child, document, descriptors);
child = child.getTreeNext();
}
}
示例3: buildChildren
import com.intellij.lang.ASTNode; //導入方法依賴的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
示例4: createElement
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
if (type == PROPERTY) {
return new CrystalPropertyImpl(node);
}
throw new AssertionError("Unknown element type: " + type);
}
示例5: getSelectorName
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static String getSelectorName(AppleScriptArgumentSelector argumentSelector) {
final StringBuilder result = new StringBuilder();
ASTNode child = argumentSelector.getNode().getFirstChildNode();
while (child != null) {
final IElementType tt = child.getElementType();
if (tt == AppleScriptTypes.IDENTIFIER || tt == AppleScriptTypes.COLON) {
result.append(child.getText());
}
child = child.getTreeNext();
}
return result.toString();
}
示例6: buildChildren
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Override
protected List<Block> buildChildren() {
List<ASTNode> todoNodes = new ArrayList<>();
List<Block> blocks = new ArrayList<>();
todoNodes.add(getNode().getFirstChildNode());
CsvBlockField currentField = null;
while (todoNodes.size() > 0) {
ASTNode node = todoNodes.remove(todoNodes.size() - 1);
if (node == null) {
continue;
}
IElementType elementType = node.getElementType();
todoNodes.add(node.getTreeNext());
if (elementType == CsvTypes.RECORD) {
todoNodes.add(node.getFirstChildNode());
} else if (elementType == CsvTypes.FIELD) {
currentField = new CsvBlockField(node, formattingInfo);
if (currentField.getTextLength() > 0) {
blocks.add(currentField);
}
} else if (elementType == CsvTypes.COMMA || elementType == CsvTypes.CRLF) {
blocks.add(new CsvBlockElement(node, formattingInfo, currentField));
} else if (elementType != TokenType.WHITE_SPACE && node.getTextLength() > 0) {
blocks.add(new CsvDummyBlock(node, formattingInfo));
}
}
return blocks;
}
示例7: getPlaceholderText
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Nullable
@Override
public String getPlaceholderText(@NotNull ASTNode node) {
IElementType elementType = node.getElementType();
if (elementType == RmlTypes.INSTANCE.COMMENT) {
return "/*...*/";
} else if (elementType == OclTypes.INSTANCE.COMMENT) {
return "(*...*)";
}
return "{...}";
}
示例8: createElement
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
if (type == COMMENT) {
return new DotEnvCommentImpl(node);
}
else if (type == EMPTY_LINE) {
return new DotEnvEmptyLineImpl(node);
}
else if (type == PROPERTY) {
return new DotEnvPropertyImpl(node);
}
throw new AssertionError("Unknown element type: " + type);
}
示例9: createElement
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
if (type == MAPPING) {
return new CptMappingImpl(node);
}
else if (type == MAPPINGS) {
return new CptMappingsImpl(node);
}
else if (type == REPLACEMENT) {
return new CptReplacementImpl(node);
}
else if (type == TEMPLATE) {
return new CptTemplateImpl(node);
}
else if (type == TEMPLATE_CODE_G) {
return new CptTemplateCodeGImpl(node);
}
else if (type == TEMPLATE_VARIABLE) {
return new CptTemplateVariableImpl(node);
}
else if (type == TEMPLATE_VARIABLE_EXPRESSION_G) {
return new CptTemplateVariableExpressionGImpl(node);
}
else if (type == TEMPLATE_VARIABLE_NAME_G) {
return new CptTemplateVariableNameGImpl(node);
}
else if (type == TEMPLATE_VARIABLE_VALUE_G) {
return new CptTemplateVariableValueGImpl(node);
}
throw new AssertionError("Unknown element type: " + type);
}
示例10: buildChildren
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Override
protected List<Block> buildChildren() {
List<Block> blocks = new ArrayList<>();
ASTNode child = myNode.getFirstChildNode();
while (child != null) {
final IElementType elementType = child.getElementType();
final Indent indent = elementType == CptTypes.MAPPINGS
? Indent.getNormalIndent()
: Indent.getNoneIndent();
final Indent childIndent = _Set(CptTypes.TEMPLATE,CptTypes.MAPPINGS, CptTypes.MAPPING, CptTypes.REPLACEMENT,
CptTypes.TEMPLATE_ESCAPE, CptTypes.TEMPLATE_CODE, CptTypes.TEMPLATE_VARIABLE).contains(elementType)
? Indent.getNormalIndent()
: Indent.getNoneIndent();
if (elementType != TokenType.WHITE_SPACE) {
Alignment alignment = null; //Alignment.createAlignment();
/*
if (elementType == CptTypes.MAP) {
alignment = mapAlignment;
}
*/
Block block = new CptBlock(child, Wrap.createWrap(WrapType.NONE, false), indent, childIndent, alignment, spacingBuilder);
blocks.add(block);
}
child = child.getTreeNext();
}
return blocks;
}
示例11: buildChildren
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Override
protected List<Block> buildChildren() {
ASTNode node = this.getNode().getFirstChildNode();
List<Block> blocks = new ArrayList<>();
while (node != null) {
if (node.getElementType() != TokenType.WHITE_SPACE) {
CsvBlockElement block = new CsvBlockElement(node, formattingInfo, this);
blocks.add(block);
}
node = node.getTreeNext();
}
return blocks;
}
示例12: getSpacing
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
Spacing getSpacing(@Nullable AppleScriptBlock child1, @NotNull AppleScriptBlock child2) {
if (child1 == null) {
return null;
}
final ASTNode node = child2.getNode();
_init(node);
final ASTNode node1 = child1.getNode();
final IElementType type1 = node1.getElementType();
final ASTNode node2 = child2.getNode();
final IElementType parent2 = node2.getTreeParent().getElementType();
final IElementType type2 = node2.getElementType();
if (LCURLY == type1 || RCURLY == type2) return Spacing.createSpacing(0, 0, 0, true, 0);
// handlerCall(params)
if (LPAREN == type2 && HANDLER_POSITIONAL_PARAMETERS_CALL_EXPRESSION == parent2) {
return addSingleSpaceIf(mySettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES, false);
}
if (LPAREN == type2 && HANDLER_POSITIONAL_PARAMETERS_DEFINITION == parent2) {
return addSingleSpaceIf(mySettings.SPACE_BEFORE_METHOD_PARENTHESES, false);
}
if (IF == type1 && LPAREN == type2) {
return addSingleSpaceIf(mySettings.SPACE_BEFORE_IF_PARENTHESES, false);
}
if (LPAREN == type1 || RPAREN == type2) return Spacing.createSpacing(0, 0, 0, true, 0);
if (COMMA == type2) return Spacing.createSpacing(0, 0, 0, true, 0);
if (type1 == IDENTIFIER && type2 == HANDLER_PARAMETER_LABEL) {
return Spacing.createSpacing(1, 1, 0, true, 0);
}
if (type2 == COLON) return Spacing.createSpacing(0, 0, 0, true, 0);
if ((KEYWORDS.contains(type1) || HANDLER_PARAMETER_LABEL == type1) && NLS != type2) {
return Spacing.createSpacing(1, 1, 0, true, 0);
}
if (BAND == type1 || BAND == type2) {
return Spacing.createSpacing(1, 1, 0, true, 0);
}
return null;
}
示例13: createElement
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
if (type == ACTION_SPEC) {
return new ActionSpecActionSpecImpl(node);
}
else if (type == AS_CLAUSE) {
return new ActionSpecAsClauseImpl(node);
}
else if (type == ATOM_IDENTIFIER) {
return new ActionSpecAtomIdentifierImpl(node);
}
else if (type == BASIC_TERM) {
return new ActionSpecBasicTermImpl(node);
}
else if (type == CALLABLE) {
return new ActionSpecCallableImpl(node);
}
else if (type == FILE_REFERENCE) {
return new ActionSpecFileReferenceImpl(node);
}
else if (type == IDENTIFIER) {
return new ActionSpecIdentifierImpl(node);
}
else if (type == LIST) {
return new ActionSpecListImpl(node);
}
else if (type == NUMBER) {
return new ActionSpecNumberImpl(node);
}
else if (type == OPERATOR) {
return new ActionSpecOperatorImpl(node);
}
else if (type == PREDICATE) {
return new ActionSpecPredicateImpl(node);
}
else if (type == STRING) {
return new ActionSpecStringImpl(node);
}
else if (type == TERM) {
return new ActionSpecTermImpl(node);
}
else if (type == TERM_LIST) {
return new ActionSpecTermListImpl(node);
}
else if (type == USAGE) {
return new ActionSpecUsageImpl(node);
}
else if (type == USE_CLAUSE) {
return new ActionSpecUseClauseImpl(node);
}
throw new AssertionError("Unknown element type: " + type);
}
示例14: createElement
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement createElement(MlTypes types, ASTNode node) {
IElementType type = node.getElementType();
if (type == types.EXTERNAL_EXPRESSION) {
return new PsiExternalImpl(types, node);
} else if (type == types.EXCEPTION_EXPRESSION) {
return new PsiExceptionImpl(node);
} else if (type == types.EXCEPTION_NAME) {
return new PsiExceptionNameImpl(node);
} else if (type == types.OPEN_EXPRESSION) {
return new PsiOpenImpl(types, node);
} else if (type == types.INCLUDE_EXPRESSION) {
return new PsiIncludeImpl(types, node);
} else if (type == types.TYPE_EXPRESSION) {
return new PsiTypeImpl(types, node);
} else if (type == types.TYPE_CONSTR_NAME) {
return new PsiTypeNameImpl(types, node);
} else if (type == types.MODULE_EXPRESSION) {
return new PsiModuleImpl(node);
} else if (type == types.MODULE_NAME) {
return new PsiModuleNameImpl(types, node);
} else if (type == types.MODULE_PATH) {
return new PsiModulePath(node);
} else if (type == types.LET_EXPRESSION) {
return new PsiLetImpl(node);
} else if (type == types.VAL_EXPRESSION) {
return new PsiValImpl(types, node);
} else if (type == types.ANNOTATION_EXPRESSION) {
return new PsiAnnotation(node);
} else if (type == types.FUN_BODY) {
return new PsiFunBody(node);
} else if (type == types.LET_BINDING) {
return new PsiLetBinding(node);
} else if (type == types.MACRO_NAME) {
return new PsiMacroName(node);
} else if (type == types.SCOPED_EXPR || type == types.OBJECT_EXPR || type == types.PATTERN_MATCH_EXPR) {
return new PsiScopedExpr(node);
} else if (type == types.SIG_SCOPE) {
return new PsiSignatureImpl(node);
} else if (type == types.TAG_START) {
return new PsiTagStart(node);
} else if (type == types.TAG_PROPERTY) {
return new PsiTagPropertyImpl(types, node);
} else if (type == types.TAG_CLOSE) {
return new PsiTagClose(node);
} else if (type == types.VAR_NAME) {
return new PsiVarNameImpl(types, node);
}
return new PsiToken(node);
}
示例15: isNewColumn
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Contract(pure = true)
private boolean isNewColumn(@Nullable final ASTNode currentNode) {
return null != currentNode && ImpexTypes.VALUE_GROUP == currentNode.getElementType();
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:5,代碼來源:ColumnsAlignmentStrategy.java