@@ -21,6 +21,7 @@ public class SearchDialog extends JDialog {
21
21
private final List <ViewerFile > searchResults ;
22
22
private final JList <ViewerFile > list ;
23
23
private final JTextArea searchBox ;
24
+ private final ListModel <ViewerFile > listModel ;
24
25
25
26
private String oldFilter = "" ;
26
27
@@ -31,7 +32,8 @@ public SearchDialog(String needle, List<ViewerFile> matches) {
31
32
pane .setPreferredSize (new Dimension (850 , 400 ));
32
33
pane .setLayout (new MigLayout ("fill" ));
33
34
pane .add (new JLabel (needle + " found in:" ), "pushx, growx, wrap" );
34
- list = new JList <>(createSortedListModel ());
35
+ listModel = createSortedListModel ();
36
+ list = new JList <>(listModel );
35
37
list .setSelectionMode (ListSelectionModel .SINGLE_INTERVAL_SELECTION );
36
38
list .setLayoutOrientation (JList .VERTICAL );
37
39
@@ -105,7 +107,7 @@ public void keyReleased(KeyEvent e) {
105
107
}
106
108
107
109
public void openResult (int index ) {
108
- ViewerFile vf = searchResults . get (index );
110
+ ViewerFile vf = listModel . getElementAt (index );
109
111
JDA .viewer .navigator .openClassFileToWorkSpace (vf );
110
112
}
111
113
0 commit comments