thank you. but i don't know how to import JavaPsiFacade, i find it in com.intellij.psi.JavaPsiFacade from the api document. but it doesn't work. the package com.intellij.psi does not have class JavaPsiFacade .
in idea 7 cache.getAllClassNames(false); can return the real class names ,the length of the return array is matched the classes number. but in idea 8 , what ever how many classes in the project , the length of the return array is 25736 , seems it include all things , libraries or none libraries ...
as the size of the array is so large , when i do a loop to enumerate all classes by using cache.getClassesByName , it cost to much time , how can i improve this ?
Hello lingll,
PsiShortNameCache cache = JavaPsiFacade.getInstance(project).getShortNamesCache();
String[] classNames = cache.getAllClassNames();
for(String className: classNames) { cache.getClassesByName(name, GlobalSearchScope.projectScope(project);
}
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
thank you.
but i don't know how to import JavaPsiFacade, i find it in com.intellij.psi.JavaPsiFacade from the api document. but it doesn't work.
the package com.intellij.psi does not have class JavaPsiFacade .
Hello lingll,
JavaPsiFacade was added in IDEA 8. In IDEA 7, use PsiManager.getShortNamesCache()
instead.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
ha, it does work!
thank you very much!
in idea 7 cache.getAllClassNames(false); can return the real class names ,the length of the return array is matched the classes number.
but in idea 8 , what ever how many classes in the project , the length of the return array is 25736 , seems it include all things , libraries or none libraries ...
as the size of the array is so large , when i do a loop to enumerate all classes by using cache.getClassesByName , it cost to much time , how can i improve this ?
thanks.
i find this
getAllClassNames(boolean searchInLibraries)
Returns the list of names of all classes in the project and (optionally) libraries.
it seems getAllClassNames in the old version of idea has a parameter which can determine whether include libraries .
how can i do the same in idea 8?
For those who follow, the class names cache class location changed IDEA 12...