title |
---|
PSI Cookbook |
This page gives a list of recipes for the most common operations for working with the PSI (Program Structure Interface). Unlike Developing Custom Language Plugins, it talks about working with the PSI of existing languages (such as Java).
TIP Please see also Working with PSI efficiently.
FilenameIndex.getFilesByName()
ReferencesSearch.search()
RefactoringFactory.createRename()
FileContentUtil.reparseFiles()
ClassInheritorsSearch.search()
JavaPsiFacade.findClass()
PsiShortNamesCache.getInstance().getClassesByName()
PsiClass.getSuperClass()
PsiJavaFile javaFile = (PsiJavaFile) psiClass.getContainingFile();
PsiPackage pkg = JavaPsiFacade.getInstance(project).findPackage(javaFile.getPackageName());
or
com.intellij.psi.util.PsiUtil.getPackageName()
OverridingMethodsSearch.search()