1 package com
.intellij
.psi
.impl
.source
;
3 import com
.intellij
.extapi
.psi
.ASTDelegatePsiElement
;
4 import com
.intellij
.lang
.ASTNode
;
5 import com
.intellij
.psi
.PsiElement
;
6 import com
.intellij
.psi
.impl
.source
.tree
.TreeElement
;
7 import org
.jetbrains
.annotations
.Nullable
;
9 public class SourceTreeToPsiMap
{
10 private SourceTreeToPsiMap() {
13 public static PsiElement
treeElementToPsi(@Nullable ASTNode element
) {
14 if (element
== null) return null;
15 return element
.getPsi();
18 public static ASTNode
psiElementToTree(@Nullable PsiElement psiElement
) {
19 if (psiElement
== null) return null;
20 return psiElement
.getNode();
23 public static boolean hasTreeElement(@Nullable PsiElement psiElement
) {
24 return psiElement
instanceof TreeElement
|| psiElement
instanceof ASTDelegatePsiElement
|| psiElement
instanceof PsiFileImpl
;