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


Java ASTNode.getPsi方法代碼示例

本文整理匯總了Java中com.intellij.lang.ASTNode.getPsi方法的典型用法代碼示例。如果您正苦於以下問題:Java ASTNode.getPsi方法的具體用法?Java ASTNode.getPsi怎麽用?Java ASTNode.getPsi使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.ASTNode的用法示例。


在下文中一共展示了ASTNode.getPsi方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

示例2: getNameIdentifier

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement getNameIdentifier(TSFnDeclStmt element) {
    ASTNode nameNode = element.getNode().findChildByType(TSTypes.ID);

    if (nameNode != null) {
        return nameNode.getPsi();
    }

    return null;
}
 
開發者ID:CouleeApps,項目名稱:TS-IJ,代碼行數:10,代碼來源:TSPsiImplUtil.java

示例3: createTemplateLanguageBlock

import com.intellij.lang.ASTNode; //導入方法依賴的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));
  }
}
 
開發者ID:google,項目名稱:bamboo-soy,代碼行數:40,代碼來源:SoyFormattingModelBuilder.java

示例4: getNameIdentifier

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement getNameIdentifier(CptNamedElement element) {
	ASTNode keyNode = element.getNode().findChildByType(CptTypes.CLASS_NAME);
	if (keyNode != null) {
		return keyNode.getPsi();
	} else {
		return null;
	}
}
 
開發者ID:xylo,項目名稱:intellij-postfix-templates,代碼行數:9,代碼來源:CptPsiImplUtil.java

示例5: getPlaceholderText

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Override
public String getPlaceholderText(@NotNull ASTNode node) {
    final PsiElement element = node.getPsi();
    if (element instanceof XmlAttributeValue) {
        IProperty property = getResolvedProperty((XmlAttributeValue) element);
        return property == null ? element.getText() : "{" + property.getValue() + "}";
    }
    return element.getText();
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:10,代碼來源:JspPropertyFoldingBuilder.java

示例6: isStartOfValueLine

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Contract(pure = true)
private boolean isStartOfValueLine(@Nullable final ASTNode currentNode) {
    return null != currentNode
           && PsiTreeUtil.findChildOfType(
        currentNode.getTreeParent().getPsi(),
        ImpexValueGroup.class
    ) == currentNode.getPsi();
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:9,代碼來源:ColumnsAlignmentStrategy.java

示例7: getYAMLElements

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public List<YAMLPsiElement> getYAMLElements() {
    final ArrayList<YAMLPsiElement> result = new ArrayList<>();
    for (ASTNode node : getNode().getChildren(null)) {
        final PsiElement psi = node.getPsi();
        if (psi instanceof YAMLPsiElement) {
            result.add((YAMLPsiElement) psi);
        }
    }
    return result;
}
 
開發者ID:seedstack,項目名稱:intellij-plugin,代碼行數:11,代碼來源:CoffigYamlFileImpl.java

示例8: getNameIdentifier

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static PsiElement getNameIdentifier(CrystalProperty element) {
    ASTNode keyNode = element.getNode().findChildByType(CrystalTypes.KEY);
    if (keyNode != null) {
        return keyNode.getPsi();
    } else {
        return null;
    }
}
 
開發者ID:benoist,項目名稱:intellij-crystal,代碼行數:9,代碼來源:CrystalPsiImplUtil.java

示例9: getNameIdentifier

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Nullable
@Override
public PsiElement getNameIdentifier() {
  ASTNode paramNode = findParameterNode();
  return paramNode != null ? paramNode.getPsi() : null;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:7,代碼來源:AppleScriptHandlerSelectorPartImpl.java

示例10: isStartOfTheFile

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Contract(pure = true)
private boolean isStartOfTheFile(@Nullable final ASTNode currentNode) {
    return null != currentNode && currentNode.getPsi() instanceof ImpexFile;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:5,代碼來源:ColumnsAlignmentStrategy.java


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