本文整理匯總了Java中com.intellij.lang.ASTNode類的典型用法代碼示例。如果您正苦於以下問題:Java ASTNode類的具體用法?Java ASTNode怎麽用?Java ASTNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ASTNode類屬於com.intellij.lang包,在下文中一共展示了ASTNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
}
示例2: getSelectorPart
import com.intellij.lang.ASTNode; //導入依賴的package包/類
@NotNull
@Override
public String getSelectorPart() {
StringBuilder builder = new StringBuilder();
ASTNode child = getNode().getFirstChildNode();
if (child != null) {
builder.append(child.getText());
child = child.getTreeNext();
}
while (child != null && AppleScriptTokenTypesSets.COMMENT_OR_WHITE_SPACE.contains(child.getElementType()))
child = child.getTreeNext();
if (child != null && child.getElementType() == AppleScriptTypes.COLON) {
builder.append(child.getText());
}
return builder.toString();
}
示例3: annotate
import com.intellij.lang.ASTNode; //導入依賴的package包/類
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
PsiElement classElement = null;
if (element instanceof TSDatablockDecl) {
TSDatablockDecl db = (TSDatablockDecl) element;
//Find the first id node, this is kinda wonky since we have to account for whitespace nodes
//datablock ClassName(...)
ASTNode node = db.getNode();
if (node == null) {
return;
}
node = node.findChildByType(TSTypes.ID);
if (node == null) {
return;
}
classElement = node.getPsi();
} else if (element instanceof TSObjectExpr) {
TSObjectExpr obj = (TSObjectExpr) element;
//Class name should be the second thing in the element:
// new ClassName(...)
classElement = PsiTreeUtil.getChildOfType(obj, TSClassNameExpr.class);
if (classElement == null) {
return;
}
classElement = classElement.getFirstChild();
}
if (classElement == null) {
return;
}
//Only annotate if it's an id, can't really tell if it's an expr
if (classElement.getNode().getElementType().equals(TSTypes.ID)) {
createSuccessAnnotation(classElement, holder, TSSyntaxHighlighter.CLASSNAME);
}
}
示例4: getArgList
import com.intellij.lang.ASTNode; //導入依賴的package包/類
public static String getArgList(TSFnDeclStmt element) {
ASTNode argNode = element.getNode().findChildByType(TSTypes.VAR_LIST);
if (argNode != null) {
return "(" + argNode.getText() + ")";
} else {
return "()";
}
}
示例5: 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;
}
示例6: 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 "{...}";
}
示例7: getPlaceholderText
import com.intellij.lang.ASTNode; //導入依賴的package包/類
@Nullable
@Override
public String getPlaceholderText(@NotNull final ASTNode node) {
Validate.notNull(node);
return ImpexFoldingPlaceholderBuilderFactory.getPlaceholderBuilder().getPlaceholder(node.getPsi());
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:8,代碼來源:ImpexFoldingBuilder.java
示例8: getChildIndent
import com.intellij.lang.ASTNode; //導入依賴的package包/類
Indent getChildIndent(final ASTNode node) {
final IElementType elementType = node.getElementType();
if (elementType == BLOCK_BODY || elementType == TOP_BLOCK_BODY || elementType == SCRIPT_BODY) {
return Indent.getNormalIndent();
}
return Indent.getNoneIndent();
}
示例9: setName
import com.intellij.lang.ASTNode; //導入依賴的package包/類
public static PsiElement setName(CrystalProperty element, String newName) {
ASTNode keyNode = element.getNode().findChildByType(CrystalTypes.KEY);
if (keyNode != null) {
CrystalProperty property = CrystalElementFactory.createProperty(element.getProject(), newName);
ASTNode newKeyNode = property.getFirstChild().getNode();
element.getNode().replaceChild(keyNode, newKeyNode);
}
return element;
}
示例10: getValue
import com.intellij.lang.ASTNode; //導入依賴的package包/類
public static String getValue(CrystalProperty element) {
ASTNode valueNode = element.getNode().findChildByType(CrystalTypes.VALUE);
if (valueNode != null) {
return valueNode.getText();
} else {
return null;
}
}
示例11: createChildWrap
import com.intellij.lang.ASTNode; //導入依賴的package包/類
Wrap createChildWrap(ASTNode child, Wrap defaultWrap, Wrap childWrap) {
final IElementType childType = child.getElementType();
final IElementType elementType = myNode.getElementType();
if (childType == COMMA) return defaultWrap;
return defaultWrap;
}
示例12: getMatchingClassName
import com.intellij.lang.ASTNode; //導入依賴的package包/類
public static String getMatchingClassName(CptMapping element) {
ASTNode keyNode = element.getNode().findChildByType(CptTypes.CLASS_NAME);
if (keyNode != null) {
// IMPORTANT: Convert embedded escaped spaces to simple spaces
return keyNode.getText().replaceAll("\\\\ ", " ");
} else {
return null;
}
}
示例13: 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;
}
示例14: FlexibleSearchBlock
import com.intellij.lang.ASTNode; //導入依賴的package包/類
protected FlexibleSearchBlock(
@NotNull final ASTNode node,
@Nullable final Wrap wrap,
@Nullable final Alignment alignment,
@NotNull final SpacingBuilder spacingBuilder
) {
super(node, wrap, alignment);
this.spacingBuilder = spacingBuilder;
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:12,代碼來源:FlexibleSearchBlock.java
示例15: ImpexModifiersImpl
import com.intellij.lang.ASTNode; //導入依賴的package包/類
public ImpexModifiersImpl(ASTNode node) {
super(node);
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:4,代碼來源:ImpexModifiersImpl.java