@@ -1025,15 +1025,27 @@ public void rebuildImportMenu(JMenu importMenu) {
1025
1025
return ;
1026
1026
importMenu .removeAll ();
1027
1027
1028
- JMenuItem menu = new JMenuItem (_ ("Manage libraries ..." ));
1028
+ JMenuItem menu = new JMenuItem (_ ("Manage Libraries ..." ));
1029
1029
menu .addActionListener (new ActionListener () {
1030
1030
public void actionPerformed (ActionEvent e ) {
1031
1031
openManageLibrariesDialog ();
1032
1032
}
1033
1033
});
1034
1034
importMenu .add (menu );
1035
1035
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
+
1037
1049
// Split between user supplied libraries and IDE libraries
1038
1050
TargetPlatform targetPlatform = getTargetPlatform ();
1039
1051
@@ -1043,19 +1055,23 @@ public void actionPerformed(ActionEvent e) {
1043
1055
try {
1044
1056
// Find the current target. Get the platform, and then select the
1045
1057
// correct name and core path.
1058
+ String platformNameLabel ;
1046
1059
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 );
1054
1065
}
1066
+ JMenuItem platformItem = new JMenuItem (_ (platformNameLabel ));
1067
+ platformItem .setEnabled (false );
1068
+ importMenu .add (platformItem );
1069
+
1055
1070
if (ideLibs .size () > 0 ) {
1056
1071
importMenu .addSeparator ();
1057
1072
addLibraries (importMenu , ideLibs );
1058
1073
}
1074
+
1059
1075
if (userLibs .size () > 0 ) {
1060
1076
importMenu .addSeparator ();
1061
1077
addLibraries (importMenu , userLibs );
0 commit comments