How to filter PsiClass from test folder
Hi I'm building plugin, and I try to get All class that inherits specific interface/class, Everything is fine excpet that I want to exclude from search files from test folders,I can't find solution for this, Can anyone help me !?
My actual code look like this:
final Project project = e.getData(PlatformDataKeys.PROJECT);
SearchScope searchScope = GlobalSearchScope.projectScope(project);
PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass("eu.common.MyInterface", GlobalSearchScope.projectScope(project));
Query<PsiClass> query = ClassInheritorsSearch.search(psiClass, searchScope, true);
final StringBuilder stringBuilder = new StringBuilder();
query.forEach(new Processor<PsiClass>()
{
@Override
public boolean process(PsiClass psiClass)
{
//here are classes from src na test folders
stringBuilder.append(psiClass.getName()).append("\n");
return true;
}
});
Please sign in to leave a comment.
I found solution with help https://devnet.jetbrains.com/message/5538682#5538682
remove this