|
26 | 26 | import cc.arduino.packages.DiscoveryManager; |
27 | 27 | import cc.arduino.contributions.packages.ui.ContributionManagerUI; |
28 | 28 | import cc.arduino.view.SplashScreenHelper; |
| 29 | +import com.google.common.base.Predicate; |
| 30 | +import com.google.common.base.Predicates; |
| 31 | +import com.google.common.collect.Collections2; |
29 | 32 | import org.apache.commons.lang3.StringUtils; |
30 | 33 | import processing.app.debug.TargetBoard; |
31 | 34 | import processing.app.debug.TargetPackage; |
|
59 | 62 | */ |
60 | 63 | public class Base { |
61 | 64 |
|
| 65 | + public static final Predicate<UserLibrary> CONTRIBUTED = new Predicate<UserLibrary>() { |
| 66 | + @Override |
| 67 | + public boolean apply(UserLibrary library) { |
| 68 | + return library.getTypes() == null || library.getTypes().isEmpty() || library.getTypes().contains("Contributed"); |
| 69 | + } |
| 70 | + }; |
| 71 | + |
62 | 72 | static private boolean commandLine; |
63 | 73 | public static SplashScreenHelper splashScreenHelper = new SplashScreenHelper(SplashScreen.getSplashScreen()); |
64 | 74 |
|
@@ -1012,13 +1022,15 @@ protected void rebuildSketchbookMenu(JMenu menu) { |
1012 | 1022 | } |
1013 | 1023 |
|
1014 | 1024 | public LibraryList getIDELibs() { |
1015 | | - LibraryList res = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries()); |
1016 | | - res.removeAll(getUserLibs()); |
1017 | | - return res; |
| 1025 | + LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries()); |
| 1026 | + List<UserLibrary> libs = new LinkedList<UserLibrary>(Collections2.filter(new LinkedList<UserLibrary>(installedLibraries), Predicates.not(CONTRIBUTED))); |
| 1027 | + return new LibraryList(libs); |
1018 | 1028 | } |
1019 | 1029 |
|
1020 | 1030 | public LibraryList getUserLibs() { |
1021 | | - return BaseNoGui.getUserLibs(); |
| 1031 | + LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries()); |
| 1032 | + List<UserLibrary> libs = new LinkedList<UserLibrary>(Collections2.filter(new LinkedList<UserLibrary>(installedLibraries), CONTRIBUTED)); |
| 1033 | + return new LibraryList(libs); |
1022 | 1034 | } |
1023 | 1035 |
|
1024 | 1036 | public void rebuildImportMenu(JMenu importMenu) { |
|
0 commit comments