Skip to content

Commit 1964b81

Browse files
matthijskooijmancmaglie
authored andcommitted
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 89cf600 commit 1964b81

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
@@ -1511,10 +1511,21 @@ public void actionPerformed(ActionEvent actionevent) {
15111511
}
15121512

15131513
JMenuItem firstBoardItem = null;
1514-
for (JMenu platformMenu : platformMenus) {
1515-
if (firstBoardItem == null && platformMenu.getItemCount() > 0)
1516-
firstBoardItem = platformMenu.getItem(0);
1517-
boardMenu.add(platformMenu);
1514+
if (platformMenus.size() == 1) {
1515+
// When just one platform exists, add the board items directly,
1516+
// rather than using a submenu
1517+
for (Component boardItem : platformMenus.get(0).getMenuComponents()) {
1518+
boardMenu.add(boardItem);
1519+
if (firstBoardItem == null)
1520+
firstBoardItem = (JMenuItem)boardItem;
1521+
}
1522+
} else {
1523+
// For multiple platforms, use submenus
1524+
for (JMenu platformMenu : platformMenus) {
1525+
if (firstBoardItem == null && platformMenu.getItemCount() > 0)
1526+
firstBoardItem = platformMenu.getItem(0);
1527+
boardMenu.add(platformMenu);
1528+
}
15181529
}
15191530

15201531
if (firstBoardItem == null) {

0 commit comments

Comments
 (0)