|
78 | 78 | */
|
79 | 79 | public class Base {
|
80 | 80 |
|
81 |
| - public static final Predicate<UserLibrary> CONTRIBUTED = new Predicate<UserLibrary>() { |
82 |
| - @Override |
83 |
| - public boolean test(UserLibrary library) { |
84 |
| - return library.getTypes() == null || library.getTypes().isEmpty() || library.getTypes().contains("Contributed"); |
85 |
| - } |
86 |
| - }; |
| 81 | + public static final Predicate<UserLibrary> CONTRIBUTED = library -> library.getTypes() == null || library.getTypes().isEmpty() || library.getTypes().contains("Contributed"); |
| 82 | + public static final Predicate<UserLibrary> RETIRED = library -> library.getTypes() != null && library.getTypes().contains("Retired"); |
87 | 83 |
|
88 | 84 | private static final int RECENT_SKETCHES_MAX_SIZE = 5;
|
89 | 85 |
|
@@ -1116,7 +1112,18 @@ protected void rebuildSketchbookMenu(JMenu menu) {
|
1116 | 1112 |
|
1117 | 1113 | public LibraryList getIDELibs() {
|
1118 | 1114 | LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries());
|
1119 |
| - List<UserLibrary> libs = installedLibraries.stream().filter(CONTRIBUTED.negate()).collect(Collectors.toList()); |
| 1115 | + List<UserLibrary> libs = installedLibraries.stream() |
| 1116 | + .filter(CONTRIBUTED.negate()) |
| 1117 | + .filter(RETIRED.negate()) |
| 1118 | + .collect(Collectors.toList()); |
| 1119 | + return new LibraryList(libs); |
| 1120 | + } |
| 1121 | + |
| 1122 | + public LibraryList getIDERetiredLibs() { |
| 1123 | + LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries()); |
| 1124 | + List<UserLibrary> libs = installedLibraries.stream() |
| 1125 | + .filter(RETIRED) |
| 1126 | + .collect(Collectors.toList()); |
1120 | 1127 | return new LibraryList(libs);
|
1121 | 1128 | }
|
1122 | 1129 |
|
@@ -1220,6 +1227,16 @@ public void rebuildExamplesMenu(JMenu menu) {
|
1220 | 1227 | addSketchesSubmenu(menu, lib);
|
1221 | 1228 | }
|
1222 | 1229 |
|
| 1230 | + LibraryList retiredIdeLibs = getIDERetiredLibs(); |
| 1231 | + retiredIdeLibs.sort(); |
| 1232 | + if (!retiredIdeLibs.isEmpty()) { |
| 1233 | + JMenu retired = new JMenu(tr("RETIRED")); |
| 1234 | + menu.add(retired); |
| 1235 | + for (UserLibrary lib : retiredIdeLibs) { |
| 1236 | + addSketchesSubmenu(retired, lib); |
| 1237 | + } |
| 1238 | + } |
| 1239 | + |
1223 | 1240 | LibraryList userLibs = getUserLibs();
|
1224 | 1241 | if (userLibs.size() > 0) {
|
1225 | 1242 | menu.addSeparator();
|
|
0 commit comments