當前位置: 首頁>>代碼示例>>Java>>正文


Java ASTNode類代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:datathings,項目名稱:greycat-idea-plugin,代碼行數:26,代碼來源:GCMFoldingBuilder.java

示例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();
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:20,代碼來源:AppleScriptHandlerSelectorPartImpl.java

示例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);
    }
}
 
開發者ID:CouleeApps,項目名稱:TS-IJ,代碼行數:39,代碼來源:TSClassNameAnnotator.java

示例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 "()";
    }
}
 
開發者ID:CouleeApps,項目名稱:TS-IJ,代碼行數:10,代碼來源:TSPsiImplUtil.java

示例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;
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:14,代碼來源:CsvBlockField.java

示例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 "{...}";
}
 
開發者ID:reasonml-editor,項目名稱:reasonml-idea-plugin,代碼行數:13,代碼來源:FoldingBuilder.java

示例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();
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:10,代碼來源:AppleScriptIndentProcessor.java

示例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;
}
 
開發者ID:benoist,項目名稱:intellij-crystal,代碼行數:10,代碼來源:CrystalPsiImplUtil.java

示例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;
    }
}
 
開發者ID:benoist,項目名稱:intellij-crystal,代碼行數:9,代碼來源:CrystalPsiImplUtil.java

示例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;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:9,代碼來源:AppleScriptWrappingProcessor.java

示例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;
	}
}
 
開發者ID:xylo,項目名稱:intellij-postfix-templates,代碼行數:10,代碼來源:CptPsiImplUtil.java

示例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;
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:30,代碼來源:CsvBlock.java

示例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


注:本文中的com.intellij.lang.ASTNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。