Determining whether a PsiClass is from a library or not.


What's the best way to determine whether a given PsiClass comes from a library or is a source path? I had thought that it was PsiClass.isPhysical(), but evidently that doesn't do what I thought.

--Dave Griffith

1 comment
Comment actions Permalink

Dave Griffith wrote:


What's the best way to determine whether a given PsiClass comes from a
library or is a source path? I had thought that it was
PsiClass.isPhysical(), but evidently that doesn't do what I thought.

--Dave Griffith

Use getContainingFile().getVirtualFile() to arrive at a virtual file
the class is in. Henceforth the power of ProjectFileIndex and
ModuleFileIndex is at your disposal.

Friendly,
Dmitry
--
Dmitry Lomov
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.