MCPcopy
hub / github.com/arduino/Arduino / rebuildBoardsMenu

Method rebuildBoardsMenu

app/src/processing/app/Base.java:1427–1546  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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()) {

Callers 3

BaseMethod · 0.95
onIndexesUpdatedMethod · 0.95
openBoardsManagerMethod · 0.95

Calls 15

setScrollerForMethod · 0.95
getPlatformUniqueIdMethod · 0.95
trMethod · 0.80
setTopFixedCountMethod · 0.80
sizeMethod · 0.80
sortMethod · 0.80
platformsMethod · 0.65
getCustomMenusMethod · 0.65
getMethod · 0.65
getPreferencesMethod · 0.65
getIdMethod · 0.65

Tested by

no test coverage detected