Usage of PsiManager.findClass & PsiManager.findClasses

Hello all!

I would like to ask a question about usage of PsiManager.findClass & PsiManager.findClasses methods.


// Button listener in dialog's constructor:
generateNamesButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

PsiClass[] psiClasses = PsiManager.getInstance(BindConstantToInterface.project).findClasses("", GlobalSearchScope.projectScope(BindConstantToInterface.project));

PsiClass psiClass = PsiManager.getInstance(BindConstantToInterface.project).findClass("", GlobalSearchScope.projectScope(BindConstantToInterface.project));

As results psiClass is null, psiClasses is PsiClasses[] with 0 size.


What's wrong? - opened class in IDEA Project...

Sincerelly yours

Comment actions Permalink

Are you sure the class name is correct?
Are you sure you're using the correct scope? As an experiment you can try using GlobalSearchScope.allScope(BindConstantToInterface.project)).

Comment actions Permalink

Yep, sure...

Same result - no difference :(

Comment actions Permalink

Seems, I've solved the problem.

Problem was that project must be passed in dataContext when dialog is opened.


Please sign in to leave a comment.