use of io.sloeber.core.api.Json.ArduinoLibraryIndex in project arduino-eclipse-plugin by Sloeber.
the class LibraryManager method getLatestInstallableLibraries.
public static Map<String, ArduinoLibraryVersion> getLatestInstallableLibraries(Set<String> libnames) {
Set<String> remainingLibNames = new TreeSet<>(libnames);
Map<String, ArduinoLibraryVersion> ret = new HashMap<>();
for (ArduinoLibraryIndex libraryIndex : libraryIndices) {
ret.putAll(libraryIndex.getLatestInstallableLibraries(remainingLibNames));
remainingLibNames.removeAll(ret.keySet());
}
return ret;
}
use of io.sloeber.core.api.Json.ArduinoLibraryIndex in project arduino-eclipse-plugin by Sloeber.
the class LibraryManager method InstallDefaultLibraries.
public static void InstallDefaultLibraries(IProgressMonitor monitor) {
for (ArduinoLibraryIndex libindex : libraryIndices) {
for (String libraryName : Defaults.DEFAULT_INSTALLED_LIBRARIES) {
ArduinoLibrary toInstalLib = libindex.getLibrary(libraryName);
if (toInstalLib != null) {
ArduinoLibraryVersion toInstalLibVersion = toInstalLib.getNewestVersion();
ArduinoLibraryVersion instaledLibVersion = toInstalLib.getInstalledVersion();
if (toInstalLibVersion != null) {
if (toInstalLibVersion != instaledLibVersion) {
if (instaledLibVersion != null) {
unInstall(instaledLibVersion, monitor);
}
install(toInstalLibVersion, monitor);
}
}
}
}
}
}
use of io.sloeber.core.api.Json.ArduinoLibraryIndex in project arduino-eclipse-plugin by Sloeber.
the class LibraryManager method installAllLatestLibraries.
/**
* Install the latest version of all the libraries belonging to this category If
* a earlier version is installed this version will be removed before
* installation of the newer version
*
* @param category
*/
public static void installAllLatestLibraries() {
List<ArduinoLibraryIndex> libraryIndices1 = getLibraryIndices();
for (ArduinoLibraryIndex libraryIndex : libraryIndices1) {
for (ArduinoLibrary curLib : libraryIndex.getLibraries()) {
String curLibName = curLib.getName();
// $NON-NLS-1$ //$NON-NLS-2$
String[] skipArray = { "Base64", "Add others if needed" };
List<String> skipList = Arrays.asList(skipArray);
if (!skipList.contains(curLibName)) {
ArduinoLibraryVersion latestLibVersion = curLib.getNewestVersion();
if (!latestLibVersion.isInstalled()) {
ArduinoLibraryVersion installedLibVersion = curLib.getInstalledVersion();
if (installedLibVersion != null) {
unInstall(installedLibVersion, null);
}
install(latestLibVersion, null);
}
}
}
}
}
use of io.sloeber.core.api.Json.ArduinoLibraryIndex in project arduino-eclipse-plugin by Sloeber.
the class LibraryManager method loadJson.
public static void loadJson(File jsonFile) {
try (Reader reader = new FileReader(jsonFile)) {
ArduinoLibraryIndex index = new Gson().fromJson(reader, ArduinoLibraryIndex.class);
index.setJsonFile(jsonFile);
libraryIndices.add(index);
} catch (Exception e) {
Common.log(new Status(IStatus.ERROR, Activator.getId(), Manager_Failed_to_parse.replace(FILE_TAG, jsonFile.getAbsolutePath()), e));
// Delete the file so it stops damaging
jsonFile.delete();
}
}
Aggregations