Skip to content

Commit dbefad2

Browse files
author
Federico Fissore
committed
Examples from some libs have been retired
1 parent de8fcc9 commit dbefad2

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

app/src/processing/app/Base.java

+24-7
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,8 @@
7878
*/
7979
public class Base {
8080

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");
8783

8884
private static final int RECENT_SKETCHES_MAX_SIZE = 5;
8985

@@ -1116,7 +1112,18 @@ protected void rebuildSketchbookMenu(JMenu menu) {
11161112

11171113
public LibraryList getIDELibs() {
11181114
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());
11201127
return new LibraryList(libs);
11211128
}
11221129

@@ -1220,6 +1227,16 @@ public void rebuildExamplesMenu(JMenu menu) {
12201227
addSketchesSubmenu(menu, lib);
12211228
}
12221229

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+
12231240
LibraryList userLibs = getUserLibs();
12241241
if (userLibs.size() > 0) {
12251242
menu.addSeparator();

0 commit comments

Comments
 (0)