1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-25 06:22:11 +03:00

Libraries under "contributed" in lib menu are those that have types "contributed"

This commit is contained in:
Federico Fissore
2015-03-26 17:11:43 +01:00
parent 6e498ee5b9
commit 3bcbf22a2a
2 changed files with 27 additions and 8 deletions

View File

@ -26,6 +26,9 @@ import cc.arduino.contributions.libraries.ui.LibraryManagerUI;
import cc.arduino.packages.DiscoveryManager;
import cc.arduino.contributions.packages.ui.ContributionManagerUI;
import cc.arduino.view.SplashScreenHelper;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import org.apache.commons.lang3.StringUtils;
import processing.app.debug.TargetBoard;
import processing.app.debug.TargetPackage;
@ -59,6 +62,13 @@ import static processing.app.I18n._;
*/
public class Base {
public static final Predicate<UserLibrary> CONTRIBUTED = new Predicate<UserLibrary>() {
@Override
public boolean apply(UserLibrary library) {
return library.getTypes() == null || library.getTypes().isEmpty() || library.getTypes().contains("Contributed");
}
};
static private boolean commandLine;
public static SplashScreenHelper splashScreenHelper = new SplashScreenHelper(SplashScreen.getSplashScreen());
@ -1012,13 +1022,15 @@ public class Base {
}
public LibraryList getIDELibs() {
LibraryList res = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries());
res.removeAll(getUserLibs());
return res;
LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries());
List<UserLibrary> libs = new LinkedList<UserLibrary>(Collections2.filter(new LinkedList<UserLibrary>(installedLibraries), Predicates.not(CONTRIBUTED)));
return new LibraryList(libs);
}
public LibraryList getUserLibs() {
return BaseNoGui.getUserLibs();
LibraryList installedLibraries = new LibraryList(BaseNoGui.librariesIndexer.getInstalledLibraries());
List<UserLibrary> libs = new LinkedList<UserLibrary>(Collections2.filter(new LinkedList<UserLibrary>(installedLibraries), CONTRIBUTED));
return new LibraryList(libs);
}
public void rebuildImportMenu(JMenu importMenu) {