Search in sources :

Example 1 with ElementBase

use of com.intellij.psi.impl.ElementBase in project intellij-community by JetBrains.

the class SharedImplUtil method findFileElement.

public static FileASTNode findFileElement(@NotNull ASTNode element) {
    if (CHECK_FOR_READ_ACTION && element instanceof ElementBase) {
        ApplicationManager.getApplication().assertReadAccessAllowed();
    }
    ASTNode parent = element.getTreeParent();
    while (parent != null) {
        element = parent;
        parent = parent.getTreeParent();
    }
    if (element instanceof FileASTNode) {
        return (FileASTNode) element;
    }
    return null;
}
Also used : ElementBase(com.intellij.psi.impl.ElementBase) FileASTNode(com.intellij.lang.FileASTNode) ASTNode(com.intellij.lang.ASTNode) FileASTNode(com.intellij.lang.FileASTNode)

Aggregations

ASTNode (com.intellij.lang.ASTNode)1 FileASTNode (com.intellij.lang.FileASTNode)1 ElementBase (com.intellij.psi.impl.ElementBase)1