File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,6 @@ public class Base {
125
125
// these variables help rebuild the "recently used boards"
126
126
// menu on board selection
127
127
private HashMap <String , JRadioButtonMenuItem > boardItems ;
128
- private List <JRadioButtonMenuItem > recentBoardsToClear = new LinkedList <>();;
129
128
private JMenu boardMenu ;
130
129
private int recentBoardsJMenuIndex ;
131
130
@@ -1620,16 +1619,15 @@ private void rebuildRecentBoardsList() throws Exception {
1620
1619
Collection <String > recentBoardIds = PreferencesData .getCollection ("recent.boards" );
1621
1620
String currentBoard = PreferencesData .get ("board" );
1622
1621
int idxAdv = 0 ;
1623
- for (JRadioButtonMenuItem itemToClear : recentBoardsToClear ) {
1624
- boardMenu .remove (itemToClear );
1622
+ // Remove existing items until the separator
1623
+ while (!(boardMenu .getMenuComponent (recentBoardsJMenuIndex ) instanceof JSeparator )) {
1624
+ boardMenu .remove (recentBoardsJMenuIndex );
1625
1625
}
1626
- recentBoardsToClear .clear ();
1627
1626
for (String boardId : recentBoardIds ) {
1628
1627
JRadioButtonMenuItem originalItem = boardItems .get (boardId );
1629
1628
JRadioButtonMenuItem recentItem = new JRadioButtonMenuItem (originalItem .getAction ());
1630
1629
1631
1630
boardMenu .add (recentItem , recentBoardsJMenuIndex +idxAdv );
1632
- recentBoardsToClear .add (recentItem );
1633
1631
recentItem .setSelected (boardId .equals (currentBoard ));
1634
1632
idxAdv ++;
1635
1633
}
You can’t perform that action at this time.
0 commit comments