diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 020884a22a6..ea3202e13da 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1468,19 +1468,31 @@ public void actionPerformed(ActionEvent actionevent) { ButtonGroup boardsButtonGroup = new ButtonGroup(); Map buttonGroupsMap = new HashMap<>(); + int platformCount = 0; + for (TargetPackage targetPackage : BaseNoGui.packages.values()) { + for (TargetPlatform targetPlatform : targetPackage.platforms()) { + ++platformCount; + } + } + // Cycle through all packages for (TargetPackage targetPackage : BaseNoGui.packages.values()) { // For every package cycle through all platform for (TargetPlatform targetPlatform : targetPackage.platforms()) { - - // Add a title for each platform - String platformLabel = targetPlatform.getPreferences().get("name"); - if (platformLabel == null) - platformLabel = targetPackage.getId() + "-" + targetPlatform.getId(); - - JMenu platformBoardsMenu = new JMenu(tr(platformLabel)); - MenuScroller.setScrollerFor(platformBoardsMenu); - boardMenu.add(platformBoardsMenu); + JMenu platformBoardsMenu; + if (platformCount == 1) { + // With just single platform, just add all platforms directly + platformBoardsMenu = boardMenu; + } else { + // Add a submenu for each platform + String platformLabel = targetPlatform.getPreferences().get("name"); + if (platformLabel == null) + platformLabel = targetPackage.getId() + "-" + targetPlatform.getId(); + + platformBoardsMenu = new JMenu(tr(platformLabel)); + MenuScroller.setScrollerFor(platformBoardsMenu); + boardMenu.add(platformBoardsMenu); + } // Cycle through all boards of this platform for (TargetBoard board : targetPlatform.getBoards().values()) {