Searching classes dialog

Answered

Hello. I tried to write a dialog that allow select class. This is my code:

TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
.createWithInnerClassesScopeChooser(
"Choose an Entity",
GlobalSearchScope.allScope(project), new ClassFilter() {
@Override
public boolean isAccepted(PsiClass aClass) {
return true;
}
}, null);
chooser.showDialog();
final PsiClass selected = chooser.getSelected();

However I faced with two problems. First of them is there aren't any classes on the form:

And the second problem is the button OK is disabled:

 

Could you help me?

0
2 comments

Hi Sergey,

Do you have any classes in your project? Please note that a Java file not under source root is not a class.

0

Thank you!!! When I add source root, it really works!!!

0

Please sign in to leave a comment.