mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Library installer UI
This commit is contained in:
committed by
Federico Fissore
parent
0b9223c158
commit
0755c7c004
@ -64,6 +64,7 @@ public class BaseNoGui {
|
||||
// maps library name to their library folder
|
||||
static private LibraryList libraries;
|
||||
|
||||
// XXX: Remove this field
|
||||
static private List<File> librariesFolders;
|
||||
|
||||
static UserNotifier notifier = new BasicUserNotifier();
|
||||
@ -410,9 +411,8 @@ public class BaseNoGui {
|
||||
}
|
||||
|
||||
static public LibraryList getUserLibs() {
|
||||
if (libraries == null)
|
||||
return new LibraryList();
|
||||
return libraries.filterLibrariesInSubfolder(getSketchbookFolder());
|
||||
LibraryList libs = BaseNoGui.librariesIndexer.getInstalledLibraries();
|
||||
return libs.filterLibrariesInSubfolder(getSketchbookFolder());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -727,12 +727,14 @@ public class BaseNoGui {
|
||||
if (referencedPlatform != null) {
|
||||
File referencedPlatformFolder = referencedPlatform.getFolder();
|
||||
// Add libraries folder for the referenced platform
|
||||
librariesFolders.add(new File(referencedPlatformFolder, "libraries"));
|
||||
File folder = new File(referencedPlatformFolder, "libraries");
|
||||
librariesFolders.add(folder);
|
||||
}
|
||||
}
|
||||
File platformFolder = targetPlatform.getFolder();
|
||||
// Add libraries folder for the selected platform
|
||||
librariesFolders.add(new File(platformFolder, "libraries"));
|
||||
File folder = new File(platformFolder, "libraries");
|
||||
librariesFolders.add(folder);
|
||||
}
|
||||
|
||||
// Add libraries folder for the sketchbook
|
||||
@ -742,7 +744,9 @@ public class BaseNoGui {
|
||||
// Libraries located in the latest folders on the list can override
|
||||
// other libraries with the same name.
|
||||
try {
|
||||
scanAndUpdateLibraries(librariesFolders);
|
||||
BaseNoGui.librariesIndexer.setSketchbookLibrariesFolder(getSketchbookLibrariesFolder());
|
||||
BaseNoGui.librariesIndexer.setLibrariesFolders(librariesFolders);
|
||||
BaseNoGui.librariesIndexer.rescanLibraries();
|
||||
} catch (IOException e) {
|
||||
showWarning(_("Error"), _("Error loading libraries"), e);
|
||||
}
|
||||
@ -759,7 +763,7 @@ public class BaseNoGui {
|
||||
static public void populateImportToLibraryTable() {
|
||||
// Populate importToLibraryTable
|
||||
importToLibraryTable = new HashMap<String, UserLibrary>();
|
||||
for (UserLibrary lib : getLibraries()) {
|
||||
for (UserLibrary lib : librariesIndexer.getInstalledLibraries()) {
|
||||
try {
|
||||
String headers[] = headerListFromIncludePath(lib.getSrcFolder());
|
||||
for (String header : headers) {
|
||||
@ -968,14 +972,6 @@ public class BaseNoGui {
|
||||
}
|
||||
}
|
||||
|
||||
static public void scanAndUpdateLibraries(List<File> folders) throws IOException {
|
||||
libraries = scanLibraries(folders);
|
||||
}
|
||||
|
||||
static public LibraryList scanLibraries(List<File> folders) throws IOException {
|
||||
return librariesIndexer.scanLibraries(folders);
|
||||
}
|
||||
|
||||
static public void selectBoard(TargetBoard targetBoard) {
|
||||
TargetPlatform targetPlatform = targetBoard.getContainerPlatform();
|
||||
TargetPackage targetPackage = targetPlatform.getContainerPackage();
|
||||
|
@ -120,9 +120,7 @@ public class LegacyUserLibrary extends UserLibrary {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String res = "LegacyLibrary:";
|
||||
res += " (name=" + name + ")";
|
||||
return res;
|
||||
return "LegacyLibrary:" + name + "\n";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,6 @@ package processing.app.packages;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import processing.app.helpers.FileUtils;
|
||||
@ -54,15 +53,14 @@ public class LibraryList extends ArrayList<UserLibrary> {
|
||||
}
|
||||
|
||||
public void addOrReplace(UserLibrary lib) {
|
||||
UserLibrary l = getByName(lib.getName());
|
||||
if (l != null)
|
||||
remove(l);
|
||||
remove(lib);
|
||||
add(lib);
|
||||
}
|
||||
|
||||
public void addOrReplaceAll(Collection<? extends UserLibrary> c) {
|
||||
for (UserLibrary l : c)
|
||||
addOrReplace(l);
|
||||
|
||||
public void remove(UserLibrary lib) {
|
||||
UserLibrary l = getByName(lib.getName());
|
||||
if (l != null)
|
||||
super.remove(l);
|
||||
}
|
||||
|
||||
public void sort() {
|
||||
|
@ -257,15 +257,14 @@ public class UserLibrary extends ContributedLibrary {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String res = "Library:";
|
||||
res += " (name=" + name + ")";
|
||||
res += " (version=" + version + ")";
|
||||
res += " (author=" + author + ")";
|
||||
res += " (maintainer=" + maintainer + ")";
|
||||
res += " (sentence=" + sentence + ")";
|
||||
res += " (paragraph=" + paragraph + ")";
|
||||
res += " (url=" + website + ")";
|
||||
res += " (architectures=" + architectures + ")";
|
||||
String res = "Library: " + name + "\n";
|
||||
res += " (version=" + version + ")\n";
|
||||
res += " (author=" + author + ")\n";
|
||||
res += " (maintainer=" + maintainer + ")\n";
|
||||
res += " (sentence=" + sentence + ")\n";
|
||||
res += " (paragraph=" + paragraph + ")\n";
|
||||
res += " (url=" + website + ")\n";
|
||||
res += " (architectures=" + architectures + ")\n";
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user