protected static <T extends JPanel> T initReferenceEditorWithBrowseButton(
    T boundedComponent,
    ReferenceEditorWithBrowseButton editor,
    JavaControlBase<?> control
  ) {
    boundedComponent.removeAll();
    boundedComponent.add(editor);
    GlobalSearchScope resolveScope = control.getDomWrapper().getResolveScope();
    editor.addActionListener(e -> {
      DomElement domElement = control.getDomElement();
      ExtendClass extend = domElement.getAnnotation(ExtendClass.class);
      PsiClass baseClass = null;
      ClassFilter filter = null;
      if (extend != null) {
        if (extend.value().length == 1) baseClass = JavaPsiFacade.getInstance(control.getProject()).findClass(extend.value()[0], resolveScope);
        if (extend.instantiatable()) {
          filter = ClassFilter.INSTANTIABLE;
        }
      }

      PsiClass initialClass = null;
      if (domElement instanceof GenericDomValue && ((GenericDomValue<?>)domElement).getValue() instanceof PsiClass psiClass) {
        initialClass = psiClass;
      }

      TreeClassChooser chooser = TreeClassChooserFactory.getInstance(control.getProject())
        .createInheritanceClassChooser(JavaBundle.message("choose.class"), resolveScope, baseClass, initialClass, filter);
      chooser.showDialog();
      PsiClass psiClass = chooser.getSelected();
      if (psiClass != null) {
        control.setValue(psiClass);
      }
    });
    return boundedComponent;
  }
protected static <T extends JPanel> T initReferenceEditorWithBrowseButton(
    T boundedComponent,
    ReferenceEditorWithBrowseButton editor,
    JavaControlBase<?> control
  )