本文整理匯總了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);
}
}
示例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;
}
示例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));
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例9: getNameIdentifier
import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Nullable
@Override
public PsiElement getNameIdentifier() {
ASTNode paramNode = findParameterNode();
return paramNode != null ? paramNode.getPsi() : null;
}
示例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