Skip to content

Commit 2ec8c53

Browse files
committed
Match CustomMenu against unique platform id
platform.getId() gives the same result for derived cores. Issue #5260 is caused by both cores declaring as `avr`, with the same label but different identifier. This patch completes the previous one by adding the folder where the core resides to the matching id.
1 parent 2778651 commit 2ec8c53

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/src/processing/app/Base.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ public void actionPerformed(ActionEvent actionevent) {
14401440
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
14411441
for (String customMenuTitle : targetPlatform.getCustomMenus().values()) {
14421442
JMenu customMenu = new JMenu(tr(customMenuTitle));
1443-
customMenu.putClientProperty("platform", targetPlatform.getId());
1443+
customMenu.putClientProperty("platform", getPlatformUniqueId(targetPlatform));
14441444
customMenu.putClientProperty("removeOnWindowDeactivation", true);
14451445
boardsCustomMenus.add(customMenu);
14461446
}
@@ -1494,6 +1494,10 @@ public void actionPerformed(ActionEvent actionevent) {
14941494
}
14951495
}
14961496

1497+
private String getPlatformUniqueId(TargetPlatform platform) {
1498+
return platform.getId() + "_" + platform.getFolder();
1499+
}
1500+
14971501
private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
14981502
final List<JMenu> boardsCustomMenus, List<JMenuItem> menuItemsToClickAfterStartup,
14991503
Map<String, ButtonGroup> buttonGroupsMap,
@@ -1531,7 +1535,7 @@ public void actionPerformed(ActionEvent actionevent) {
15311535
PreferencesMap customMenus = targetPlatform.getCustomMenus();
15321536
for (final String menuId : customMenus.keySet()) {
15331537
String title = customMenus.get(menuId);
1534-
JMenu menu = getBoardCustomMenu(tr(title), targetPlatform.getId());
1538+
JMenu menu = getBoardCustomMenu(tr(title), getPlatformUniqueId(targetPlatform));
15351539

15361540
if (board.hasMenu(menuId)) {
15371541
PreferencesMap boardCustomMenu = board.getMenuLabels(menuId);
@@ -1601,9 +1605,9 @@ private static boolean ifThereAreVisibleItemsOn(JMenu menu) {
16011605
return false;
16021606
}
16031607

1604-
private JMenu getBoardCustomMenu(String label, String platform) throws Exception {
1608+
private JMenu getBoardCustomMenu(String label, String platformUniqueId) throws Exception {
16051609
for (JMenu menu : boardsCustomMenus) {
1606-
if (label.equals(menu.getText()) && platform.equals(menu.getClientProperty("platform"))) {
1610+
if (label.equals(menu.getText()) && menu.getClientProperty("platform").equals(platformUniqueId)) {
16071611
return menu;
16081612
}
16091613
}

0 commit comments

Comments
 (0)