public class PsiUtilCore
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
PsiUtilCore.NullPsiElement |
Modifier and Type | Field and Description |
---|---|
static PsiElement |
NULL_PSI_ELEMENT |
static PsiFile |
NULL_PSI_FILE |
Constructor and Description |
---|
PsiUtilCore() |
Modifier and Type | Method and Description |
---|---|
static int |
compareElementsByPosition(PsiElement element1,
PsiElement element2) |
static void |
ensureValid(PsiElement element)
Checks if the element is valid.
|
static PsiFileSystemItem |
findFileSystemItem(Project project,
VirtualFile file) |
static Language |
findLanguageFromElement(PsiElement elt) |
static Language |
getDialect(PsiElement element) |
static PsiElement |
getElementAtOffset(PsiFile file,
int offset) |
static IElementType |
getElementType(ASTNode node) |
static IElementType |
getElementType(PsiElement element) |
static Language |
getLanguageAtOffset(PsiFile file,
int offset) |
static java.lang.String |
getName(PsiElement element) |
static Language |
getNotAnyLanguage(ASTNode node) |
static <T extends PsiElement> |
getOriginalElement(T psiElement,
java.lang.Class<? extends T> elementClass)
Deprecated.
use CompletionUtil#getOriginalElement where appropriate instead
|
static Project |
getProjectInReadAction(PsiElement element) |
static PsiFile |
getPsiFile(Project project,
VirtualFile file)
Tries to find PSI file for a virtual file and throws assertion error with debug info if it is null.
|
static java.lang.String |
getQualifiedNameAfterRename(java.lang.String qName,
java.lang.String newName) |
static PsiFile |
getTemplateLanguageFile(PsiElement element) |
static VirtualFile |
getVirtualFile(PsiElement element) |
static boolean |
hasErrorElementChild(PsiElement element) |
static Language |
narrowLanguage(Language language,
Language candidate) |
static PsiElement [] |
toPsiElementArray(java.util.Collection<? extends PsiElement> collection) |
static PsiFile [] |
toPsiFileArray(java.util.Collection<? extends PsiFile> collection) |
static <VF extends VirtualFile> |
toPsiFiles(PsiManager psiManager,
java.util.Collection<VF> virtualFiles) |
public static final PsiElement NULL_PSI_ELEMENT
public static final PsiFile NULL_PSI_FILE
public static PsiElement [] toPsiElementArray(java.util.Collection<? extends PsiElement> collection)
public static VirtualFile getVirtualFile(PsiElement element)
public static int compareElementsByPosition(PsiElement element1, PsiElement element2)
public static boolean hasErrorElementChild(PsiElement element)
public static PsiElement getElementAtOffset(PsiFile file, int offset)
public static PsiFile getTemplateLanguageFile(PsiElement element)
public static PsiFile [] toPsiFileArray(java.util.Collection<? extends PsiFile> collection)
public static <VF extends VirtualFile> java.util.List<PsiFile> toPsiFiles(PsiManager psiManager, java.util.Collection<VF> virtualFiles)
public static java.lang.String getName(PsiElement element)
public static java.lang.String getQualifiedNameAfterRename(java.lang.String qName, java.lang.String newName)
public static Language getDialect(PsiElement element)
public static void ensureValid(PsiElement element)
PsiInvalidElementAccessException
with
a meaningful message that points to the reasons why the element is not valid and may contain the stack trace
when it was invalidated.public static PsiFileSystemItem findFileSystemItem(Project project, VirtualFile file)
public static PsiFile getPsiFile(Project project, VirtualFile file)
@Deprecated public static <T extends PsiElement> T getOriginalElement(T psiElement, java.lang.Class<? extends T> elementClass)
public static Language findLanguageFromElement(PsiElement elt)
public static Project getProjectInReadAction(PsiElement element)
public static IElementType getElementType(ASTNode node)
public static IElementType getElementType(PsiElement element)