@@ -1122,32 +1122,26 @@ public void actionPerformed(ActionEvent e) {
11221122 menu .addSeparator ();
11231123
11241124 // Add a list of all sketches and subfolders
1125- try {
1126- boolean sketches = addSketches (menu , BaseNoGui .getSketchbookFolder (), true );
1127- if (sketches ) menu .addSeparator ();
1128- } catch (IOException e ) {
1129- e .printStackTrace ();
1130- }
1125+ boolean sketches = addSketches (menu , BaseNoGui .getSketchbookFolder (), true );
1126+ if (sketches ) menu .addSeparator ();
11311127
11321128 // Add each of the subfolders of examples directly to the menu
1133- try {
1134- boolean found = addSketches (menu , BaseNoGui .getExamplesFolder (), true );
1135- if (found ) menu .addSeparator ();
1136- } catch (IOException e ) {
1137- e .printStackTrace ();
1138- }
1129+ boolean found = addSketches (menu , BaseNoGui .getExamplesFolder (), true );
1130+ if (found ) menu .addSeparator ();
11391131 }
11401132
11411133
11421134 protected void rebuildSketchbookMenu (JMenu menu ) {
1143- //System.out.println("rebuilding sketchbook menu");
1144- //new Exception().printStackTrace();
1145- try {
1146- menu .removeAll ();
1147- addSketches (menu , BaseNoGui .getSketchbookFolder (), false );
1148- //addSketches(menu, getSketchbookFolder());
1149- } catch (IOException e ) {
1150- e .printStackTrace ();
1135+ menu .removeAll ();
1136+ addSketches (menu , BaseNoGui .getSketchbookFolder (), false );
1137+
1138+ JMenu librariesMenu = JMenuUtils .findSubMenuWithLabel (menu , "libraries" );
1139+ if (librariesMenu != null ) {
1140+ menu .remove (librariesMenu );
1141+ }
1142+ JMenu hardwareMenu = JMenuUtils .findSubMenuWithLabel (menu , "hardware" );
1143+ if (hardwareMenu != null ) {
1144+ menu .remove (hardwareMenu );
11511145 }
11521146 }
11531147
@@ -1234,30 +1228,28 @@ public void actionPerformed(ActionEvent event) {
12341228 }
12351229
12361230 public void rebuildExamplesMenu (JMenu menu ) {
1237- if (menu == null )
1231+ if (menu == null ) {
12381232 return ;
1239- try {
1240- menu .removeAll ();
1233+ }
12411234
1242- // Add examples from distribution "example" folder
1243- boolean found = addSketches (menu , BaseNoGui .getExamplesFolder (), false );
1244- if (found ) menu .addSeparator ();
1235+ menu .removeAll ();
12451236
1246- // Add examples from libraries
1247- LibraryList ideLibs = getIDELibs ();
1248- ideLibs .sort ();
1249- for (UserLibrary lib : ideLibs )
1237+ // Add examples from distribution "example" folder
1238+ boolean found = addSketches (menu , BaseNoGui .getExamplesFolder (), false );
1239+ if (found ) menu .addSeparator ();
1240+
1241+ // Add examples from libraries
1242+ LibraryList ideLibs = getIDELibs ();
1243+ ideLibs .sort ();
1244+ for (UserLibrary lib : ideLibs )
1245+ addSketchesSubmenu (menu , lib , false );
1246+
1247+ LibraryList userLibs = getUserLibs ();
1248+ if (userLibs .size () > 0 ) {
1249+ menu .addSeparator ();
1250+ userLibs .sort ();
1251+ for (UserLibrary lib : userLibs )
12501252 addSketchesSubmenu (menu , lib , false );
1251-
1252- LibraryList userLibs = getUserLibs ();
1253- if (userLibs .size () > 0 ) {
1254- menu .addSeparator ();
1255- userLibs .sort ();
1256- for (UserLibrary lib : userLibs )
1257- addSketchesSubmenu (menu , lib , false );
1258- }
1259- } catch (IOException e ) {
1260- e .printStackTrace ();
12611253 }
12621254 }
12631255
@@ -1588,7 +1580,7 @@ public void actionPerformed(ActionEvent actionevent) {
15881580 * should replace the sketch in the current window, or false when the
15891581 * sketch should open in a new window.
15901582 */
1591- protected boolean addSketches (JMenu menu , File folder , final boolean replaceExisting ) throws IOException {
1583+ protected boolean addSketches (JMenu menu , File folder , final boolean replaceExisting ) {
15921584 if (folder == null )
15931585 return false ;
15941586
@@ -1624,14 +1616,13 @@ public int compare(File file, File file2) {
16241616 }
16251617
16261618 private boolean addSketchesSubmenu (JMenu menu , UserLibrary lib ,
1627- boolean replaceExisting )
1628- throws IOException {
1619+ boolean replaceExisting ) {
16291620 return addSketchesSubmenu (menu , lib .getName (), lib .getInstalledFolder (),
16301621 replaceExisting );
16311622 }
16321623
16331624 private boolean addSketchesSubmenu (JMenu menu , String name , File folder ,
1634- final boolean replaceExisting ) throws IOException {
1625+ final boolean replaceExisting ) {
16351626
16361627 ActionListener listener = new ActionListener () {
16371628 public void actionPerformed (ActionEvent e ) {
0 commit comments