mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
5678 fix reseting of content viewer when nothing in instances table
This commit is contained in:
parent
6aa99b5844
commit
6efd161deb
@ -142,14 +142,22 @@ public class ResultsPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
synchronized void populateInstancesList() {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
instancesList.removeListSelectionListener(listener);
|
||||
instancesListModel.removeAllElements();
|
||||
for (AbstractFile file : getInstancesForSelected()) {
|
||||
instancesListModel.addElement(file);
|
||||
}
|
||||
instancesList.addListSelectionListener(listener);
|
||||
if (!instancesListModel.isEmpty()) {
|
||||
instancesList.setSelectedIndex(0);
|
||||
List<AbstractFile> files = getInstancesForSelected();
|
||||
if (files.isEmpty()) {
|
||||
//if there are no files currently remove the current items without removing listener to cause content viewer to reset
|
||||
instancesListModel.removeAllElements();
|
||||
} else {
|
||||
//remove listener so content viewer node is not set multiple times
|
||||
instancesList.removeListSelectionListener(listener);
|
||||
instancesListModel.removeAllElements();
|
||||
for (AbstractFile file : files) {
|
||||
instancesListModel.addElement(file);
|
||||
}
|
||||
//add listener back to allow selection of first index to cause content viewer node to be set
|
||||
instancesList.addListSelectionListener(listener);
|
||||
if (!instancesListModel.isEmpty()) {
|
||||
instancesList.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user