5316 hide file search by attributes instead of disposing of it.

This commit is contained in:
William Schaefer 2021-07-27 11:38:59 -04:00
parent 464f96baad
commit 2b528fd792
2 changed files with 7 additions and 5 deletions

View File

@ -31,9 +31,11 @@ final class FileSearchAction extends CallableSystemAction implements FileSearchP
private static final long serialVersionUID = 1L;
private static FileSearchAction instance = null;
private static final FileSearchDialog searchDialog = new FileSearchDialog();
FileSearchAction() {
super();
searchDialog.setVisible(false);
setEnabled(Case.isCaseOpen());
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) {
@ -51,12 +53,12 @@ final class FileSearchAction extends CallableSystemAction implements FileSearchP
@Override
public void actionPerformed(ActionEvent e) {
new FileSearchDialog().setVisible(true);
searchDialog.setVisible(true);
}
@Override
public void performAction() {
new FileSearchDialog().setVisible(true);
searchDialog.setVisible(true);
}
@Override

View File

@ -27,12 +27,12 @@ import org.openide.windows.WindowManager;
* File search dialog
*/
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
class FileSearchDialog extends javax.swing.JDialog {
final class FileSearchDialog extends javax.swing.JDialog {
/**
* Creates new form FileSearchDialog
*/
public FileSearchDialog() {
FileSearchDialog() {
super(WindowManager.getDefault().getMainWindow(),
NbBundle.getMessage(FileSearchDialog.class, "FileSearchDialog.frame.msg"), true);
initComponents();
@ -43,7 +43,7 @@ class FileSearchDialog extends javax.swing.JDialog {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
setVisible(false);
}
});
}