()
| 1425 | } |
| 1426 | |
| 1427 | public void rebuildBoardsMenu() throws Exception { |
| 1428 | boardsCustomMenus = new LinkedList<>(); |
| 1429 | |
| 1430 | // The first custom menu is the "Board" selection submenu |
| 1431 | JMenu boardMenu = new JMenu(tr("Board")); |
| 1432 | boardMenu.putClientProperty("removeOnWindowDeactivation", true); |
| 1433 | MenuScroller.setScrollerFor(boardMenu).setTopFixedCount(1); |
| 1434 | |
| 1435 | boardMenu.add(new JMenuItem(new AbstractAction(tr("Boards Manager...")) { |
| 1436 | public void actionPerformed(ActionEvent actionevent) { |
| 1437 | String filterText = ""; |
| 1438 | String dropdownItem = ""; |
| 1439 | if (actionevent instanceof Event) { |
| 1440 | Event e = ((Event) actionevent); |
| 1441 | filterText = e.getPayload().get("filterText").toString(); |
| 1442 | dropdownItem = e.getPayload().get("dropdownItem").toString(); |
| 1443 | } |
| 1444 | try { |
| 1445 | openBoardsManager(filterText, dropdownItem); |
| 1446 | } catch (Exception e) { |
| 1447 | //TODO show error |
| 1448 | e.printStackTrace(); |
| 1449 | } |
| 1450 | } |
| 1451 | })); |
| 1452 | boardsCustomMenus.add(boardMenu); |
| 1453 | |
| 1454 | // If there are no platforms installed we are done |
| 1455 | if (BaseNoGui.packages.size() == 0) |
| 1456 | return; |
| 1457 | |
| 1458 | // Separate "Install boards..." command from installed boards |
| 1459 | boardMenu.add(new JSeparator()); |
| 1460 | |
| 1461 | // Generate custom menus for all platforms |
| 1462 | for (TargetPackage targetPackage : BaseNoGui.packages.values()) { |
| 1463 | for (TargetPlatform targetPlatform : targetPackage.platforms()) { |
| 1464 | for (String customMenuTitle : targetPlatform.getCustomMenus().values()) { |
| 1465 | JMenu customMenu = new JMenu(tr(customMenuTitle)); |
| 1466 | customMenu.putClientProperty("platform", getPlatformUniqueId(targetPlatform)); |
| 1467 | customMenu.putClientProperty("removeOnWindowDeactivation", true); |
| 1468 | boardsCustomMenus.add(customMenu); |
| 1469 | MenuScroller.setScrollerFor(customMenu); |
| 1470 | } |
| 1471 | } |
| 1472 | } |
| 1473 | |
| 1474 | List<JMenuItem> menuItemsToClickAfterStartup = new LinkedList<>(); |
| 1475 | |
| 1476 | ButtonGroup boardsButtonGroup = new ButtonGroup(); |
| 1477 | Map<String, ButtonGroup> buttonGroupsMap = new HashMap<>(); |
| 1478 | |
| 1479 | List<JMenu> platformMenus = new ArrayList<>(); |
| 1480 | |
| 1481 | // Cycle through all packages |
| 1482 | for (TargetPackage targetPackage : BaseNoGui.packages.values()) { |
| 1483 | // For every package cycle through all platform |
| 1484 | for (TargetPlatform targetPlatform : targetPackage.platforms()) { |
no test coverage detected