From de8fcc9eb0aaf50c1b08309ee20a3bfa614f72b5 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 21 Sep 2015 15:31:22 +0200 Subject: [PATCH] Examples menu: added group title. Fixes #3725 --- app/src/processing/app/Base.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 94d17e2ed..6d1fe6e9d 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1200,21 +1200,36 @@ public class Base { menu.removeAll(); // Add examples from distribution "example" folder + JMenuItem label = new JMenuItem(tr("Built-in Examples")); + label.setEnabled(false); + menu.add(label); boolean found = addSketches(menu, BaseNoGui.getExamplesFolder()); - if (found) menu.addSeparator(); + if (found) { + menu.addSeparator(); + } // Add examples from libraries LibraryList ideLibs = getIDELibs(); ideLibs.sort(); - for (UserLibrary lib : ideLibs) + if (!ideLibs.isEmpty()) { + label = new JMenuItem(tr("Examples from Libraries")); + label.setEnabled(false); + menu.add(label); + } + for (UserLibrary lib : ideLibs) { addSketchesSubmenu(menu, lib); + } LibraryList userLibs = getUserLibs(); if (userLibs.size() > 0) { menu.addSeparator(); userLibs.sort(); - for (UserLibrary lib : userLibs) + label = new JMenuItem(tr("Examples from Custom Libraries")); + label.setEnabled(false); + menu.add(label); + for (UserLibrary lib : userLibs) { addSketchesSubmenu(menu, lib); + } } }