public static JPanel createSpecialAnnotationsListControl(final @NlsContexts.Label String borderTitle,
                                                           final boolean acceptPatterns,
                                                           final SortedListModel<String> listModel,
                                                           final Predicate<? super PsiClass> isApplicable) {
    final JList<String> injectionList = new JBList<>(listModel);
    injectionList.setBorder(JBUI.Borders.empty());

    injectionList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    ToolbarDecorator toolbarDecorator = ToolbarDecorator
      .createDecorator(injectionList)
      .setAddAction(new AnActionButtonRunnable() {
        @Override
        public void run(AnActionButton button) {
          Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(injectionList));
          if (project == null) project = ProjectManager.getInstance().getDefaultProject();
          TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
            .createWithInnerClassesScopeChooser(JavaBundle.message("special.annotations.list.annotation.class"),
                                                GlobalSearchScope.allScope(project), new ClassFilter() {
              @Override
              public boolean isAccepted(PsiClass aClass) {
                return isApplicable.test(aClass);
              }
            }, null);
          chooser.showDialog();
          final PsiClass selected = chooser.getSelected();
          if (selected != null) {
            listModel.add(selected.getQualifiedName());
          }
        }
      })
      .setAddActionName(JavaBundle.message("special.annotations.list.add.annotation.class"))
      .disableUpDownActions()
      .setToolbarPosition(ActionToolbarPosition.LEFT);

    if (acceptPatterns) {
      toolbarDecorator
        .setAddIcon(IconUtil.getAddClassIcon())
        .addExtraAction(
          new DumbAwareAction(JavaBundle.message("special.annotations.list.annotation.pattern"), null, IconUtil.getAddPatternIcon()) {
            @Override
            public void actionPerformed(@NotNull AnActionEvent e) {
              String selectedPattern = Messages.showInputDialog(JavaBundle.message("special.annotations.list.annotation.pattern.message"),
                                                                JavaBundle.message("special.annotations.list.annotation.pattern"),
                                                                Messages.getQuestionIcon());
              if (selectedPattern != null) {
                listModel.add(selectedPattern);
              }
            }
          })
        .setButtonComparator(JavaBundle.message("special.annotations.list.add.annotation.class"),
                             JavaBundle.message("special.annotations.list.annotation.pattern"),
                             JavaBundle.message("special.annotations.list.remove.pattern"));
    }
    final var panel = toolbarDecorator.createPanel();
    final Dimension minimumSize = acceptPatterns ? InspectionOptionsPanel.getMinimumLongListSize() : InspectionOptionsPanel.getMinimumListSize();
    panel.setMinimumSize(minimumSize);
    panel.setPreferredSize(minimumSize);

    if (borderTitle == null) return panel;

    return UI.PanelFactory
      .panel(panel)
      .withLabel(borderTitle)
      .moveLabelOnTop()
      .resizeY(true)
      .createPanel();
  }
public static JPanel createSpecialAnnotationsListControl(final @NlsContexts.Label String borderTitle,
                                                           final boolean acceptPatterns,
                                                           final SortedListModel<String> listModel,
                                                           final Predicate<? super PsiClass> isApplicable)