1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Restored Add .ZIP Library... menu

Fixed missing platform name label when using custom platforms
This commit is contained in:
Federico Fissore 2015-02-25 16:52:30 +01:00
parent cb6514e4bb
commit 33457adafe

View File

@ -1025,7 +1025,7 @@ public class Base {
return; return;
importMenu.removeAll(); importMenu.removeAll();
JMenuItem menu = new JMenuItem(_("Manage libraries...")); JMenuItem menu = new JMenuItem(_("Manage Libraries..."));
menu.addActionListener(new ActionListener() { menu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
openManageLibrariesDialog(); openManageLibrariesDialog();
@ -1033,7 +1033,19 @@ public class Base {
}); });
importMenu.add(menu); importMenu.add(menu);
importMenu.addSeparator(); importMenu.addSeparator();
JMenuItem addLibraryMenuItem = new JMenuItem(_("Add .ZIP Library..."));
addLibraryMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.this.handleAddLibrary();
Base.this.onBoardOrPortChange();
Base.this.rebuildImportMenu(Editor.importMenu);
Base.this.rebuildExamplesMenu(Editor.examplesMenu);
}
});
importMenu.add(addLibraryMenuItem);
importMenu.addSeparator();
// Split between user supplied libraries and IDE libraries // Split between user supplied libraries and IDE libraries
TargetPlatform targetPlatform = getTargetPlatform(); TargetPlatform targetPlatform = getTargetPlatform();
@ -1043,19 +1055,23 @@ public class Base {
try { try {
// Find the current target. Get the platform, and then select the // Find the current target. Get the platform, and then select the
// correct name and core path. // correct name and core path.
String platformNameLabel;
PreferencesMap prefs = targetPlatform.getPreferences(); PreferencesMap prefs = targetPlatform.getPreferences();
if (prefs != null) { if (prefs != null && prefs.get("name") != null) {
String platformName = prefs.get("name"); platformNameLabel = prefs.get("name");
if (platformName != null) { } else {
JMenuItem platformItem = new JMenuItem(_(platformName)); platformNameLabel = targetPlatform.getContainerPackage().getId() + "/" + targetPlatform.getId();
platformItem.setEnabled(false); platformNameLabel = I18n.format(_("{0} boards"), platformNameLabel);
importMenu.add(platformItem);
}
} }
JMenuItem platformItem = new JMenuItem(_(platformNameLabel));
platformItem.setEnabled(false);
importMenu.add(platformItem);
if (ideLibs.size() > 0) { if (ideLibs.size() > 0) {
importMenu.addSeparator(); importMenu.addSeparator();
addLibraries(importMenu, ideLibs); addLibraries(importMenu, ideLibs);
} }
if (userLibs.size() > 0) { if (userLibs.size() > 0) {
importMenu.addSeparator(); importMenu.addSeparator();
addLibraries(importMenu, userLibs); addLibraries(importMenu, userLibs);