@NotNull
 @Override
 public Object[] getElementsByName(
     String name, boolean checkBoxState, String pattern, @NotNull ProgressIndicator canceled) {
   List<T> classes =
       myTreeClassChooserDialog.getClassesByName(
           name, checkBoxState, pattern, myTreeClassChooserDialog.getScope());
   if (classes.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;
   if (classes.size() == 1) {
     return isAccepted(classes.get(0))
         ? ArrayUtil.toObjectArray(classes)
         : ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
   Set<String> qNames = ContainerUtil.newHashSet();
   List<T> list = new ArrayList<T>(classes.size());
   for (T aClass : classes) {
     if (qNames.add(getFullName(aClass)) && isAccepted(aClass)) {
       list.add(aClass);
     }
   }
   return ArrayUtil.toObjectArray(list);
 }
 protected boolean isAccepted(T aClass) {
   return myTreeClassChooserDialog.getFilter().isAccepted(aClass);
 }