JPanel (final ListTable table, @NlsContexts.DialogTitle final String chooserTitle, @NonNls String... ancestorClasses) { final ClassFilter filter; if (ancestorClasses.length == 0) { filter = c -> !PsiUtil.isLocalClass(c); } else { filter = new SubclassFilter(ancestorClasses); } final JPanel panel = ToolbarDecorator.createDecorator(table) .disableUpDownActions() .setToolbarPosition(ActionToolbarPosition.LEFT) .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { final DataContext dataContext = DataManager.getInstance().getDataContext(table); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final int rowIndex; final ListWrappingTableModel tableModel = table.getModel(); if (project == null) { tableModel.addRow(); rowIndex = tableModel.getRowCount() - 1; } else { final TreeClassChooserFactory chooserFactory = TreeClassChooserFactory.getInstance(project); final TreeClassChooser classChooser = chooserFactory.createWithInnerClassesScopeChooser(chooserTitle, GlobalSearchScope.allScope(project), filter, null); classChooser.showDialog(); final PsiClass selectedClass = classChooser.getSelected(); if (selectedClass == null) { return; } final String qualifiedName = selectedClass.getQualifiedName(); final int index = tableModel.indexOf(qualifiedName, 0); if (index < 0) { tableModel.addRow(qualifiedName); rowIndex = tableModel.getRowCount() - 1; } else { rowIndex = index; } } editTableCell(table, rowIndex, table.getColumnCount() > 1 && project != null ? 1 : 0); } }) .setRemoveAction(button -> TableUtil.removeSelectedItems(table)) .createPanel(); panel.setMinimumSize(InspectionOptionsPanel.getMinimumListSize()); panel.setPreferredSize(InspectionOptionsPanel.getMinimumListSize()); return panel; }