Skip to content

Commit f1cb18b

Browse files
Do not use a boards submenu with just one platform
When just one platform is installed, it does not make much sense to use a submenu, so just add the boards directly under the boards menu as before.
1 parent 38433c6 commit f1cb18b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Diff for: app/src/processing/app/Base.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -1498,10 +1498,21 @@ public void actionPerformed(ActionEvent actionevent) {
14981498
}
14991499

15001500
JMenuItem firstBoardItem = null;
1501-
for (JMenu platformMenu : platformMenus) {
1502-
if (firstBoardItem == null && platformMenu.getItemCount() > 0)
1503-
firstBoardItem = platformMenu.getItem(0);
1504-
boardMenu.add(platformMenu);
1501+
if (platformMenus.size() == 1) {
1502+
// When just one platform exists, add the board items directly,
1503+
// rather than using a submenu
1504+
for (Component boardItem : platformMenus.get(0).getMenuComponents()) {
1505+
boardMenu.add(boardItem);
1506+
if (firstBoardItem == null)
1507+
firstBoardItem = (JMenuItem)boardItem;
1508+
}
1509+
} else {
1510+
// For multiple platforms, use submenus
1511+
for (JMenu platformMenu : platformMenus) {
1512+
if (firstBoardItem == null && platformMenu.getItemCount() > 0)
1513+
firstBoardItem = platformMenu.getItem(0);
1514+
boardMenu.add(platformMenu);
1515+
}
15051516
}
15061517

15071518
if (firstBoardItem == null) {

0 commit comments

Comments
 (0)