Skip to content

Commit 33457ad

Browse files
author
Federico Fissore
committed
Restored Add .ZIP Library... menu
Fixed missing platform name label when using custom platforms
1 parent cb6514e commit 33457ad

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

app/src/processing/app/Base.java

+25-9
Original file line numberDiff line numberDiff line change
@@ -1025,15 +1025,27 @@ public void rebuildImportMenu(JMenu importMenu) {
10251025
return;
10261026
importMenu.removeAll();
10271027

1028-
JMenuItem menu = new JMenuItem(_("Manage libraries..."));
1028+
JMenuItem menu = new JMenuItem(_("Manage Libraries..."));
10291029
menu.addActionListener(new ActionListener() {
10301030
public void actionPerformed(ActionEvent e) {
10311031
openManageLibrariesDialog();
10321032
}
10331033
});
10341034
importMenu.add(menu);
10351035
importMenu.addSeparator();
1036-
1036+
1037+
JMenuItem addLibraryMenuItem = new JMenuItem(_("Add .ZIP Library..."));
1038+
addLibraryMenuItem.addActionListener(new ActionListener() {
1039+
public void actionPerformed(ActionEvent e) {
1040+
Base.this.handleAddLibrary();
1041+
Base.this.onBoardOrPortChange();
1042+
Base.this.rebuildImportMenu(Editor.importMenu);
1043+
Base.this.rebuildExamplesMenu(Editor.examplesMenu);
1044+
}
1045+
});
1046+
importMenu.add(addLibraryMenuItem);
1047+
importMenu.addSeparator();
1048+
10371049
// Split between user supplied libraries and IDE libraries
10381050
TargetPlatform targetPlatform = getTargetPlatform();
10391051

@@ -1043,19 +1055,23 @@ public void actionPerformed(ActionEvent e) {
10431055
try {
10441056
// Find the current target. Get the platform, and then select the
10451057
// correct name and core path.
1058+
String platformNameLabel;
10461059
PreferencesMap prefs = targetPlatform.getPreferences();
1047-
if (prefs != null) {
1048-
String platformName = prefs.get("name");
1049-
if (platformName != null) {
1050-
JMenuItem platformItem = new JMenuItem(_(platformName));
1051-
platformItem.setEnabled(false);
1052-
importMenu.add(platformItem);
1053-
}
1060+
if (prefs != null && prefs.get("name") != null) {
1061+
platformNameLabel = prefs.get("name");
1062+
} else {
1063+
platformNameLabel = targetPlatform.getContainerPackage().getId() + "/" + targetPlatform.getId();
1064+
platformNameLabel = I18n.format(_("{0} boards"), platformNameLabel);
10541065
}
1066+
JMenuItem platformItem = new JMenuItem(_(platformNameLabel));
1067+
platformItem.setEnabled(false);
1068+
importMenu.add(platformItem);
1069+
10551070
if (ideLibs.size() > 0) {
10561071
importMenu.addSeparator();
10571072
addLibraries(importMenu, ideLibs);
10581073
}
1074+
10591075
if (userLibs.size() > 0) {
10601076
importMenu.addSeparator();
10611077
addLibraries(importMenu, userLibs);

0 commit comments

Comments
 (0)