void (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); }