void () { PackageChooser chooser = new PackageChooserDialog(JavaCoverageBundle.message("coverage.pattern.filter.editor.choose.package.title"), myProject) { @Override protected @Nullable PsiPackage getPsiPackage(String newQualifiedName) { return JavaPsiFacade.getInstance(myProject).findPackage(newQualifiedName); } @Override protected boolean canExpandInSpeedSearch() { return true; } }; if (chooser.showAndGet()) { List<PsiPackage> packages = chooser.getSelectedPackages(); if (!packages.isEmpty()) { for (final PsiPackage aPackage : packages) { final String fqName = aPackage.getQualifiedName(); final String pattern = fqName.isEmpty() ? "*" : fqName + ".*"; myTableModel.addRow(createFilter(pattern)); } int row = myTableModel.getRowCount() - 1; myTable.getSelectionModel().setSelectionInterval(row, row); myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true)); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myTable, true)); } } }