Search in sources :

Example 1 with ArduinoLibrary

use of io.sloeber.core.api.Json.ArduinoLibrary 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);
                    }
                }
            }
        }
    }
}
Also used : ArduinoLibraryVersion(io.sloeber.core.api.Json.ArduinoLibraryVersion) ArduinoLibraryIndex(io.sloeber.core.api.Json.ArduinoLibraryIndex) ArduinoLibrary(io.sloeber.core.api.Json.ArduinoLibrary)

Example 2 with ArduinoLibrary

use of io.sloeber.core.api.Json.ArduinoLibrary 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);
                }
            }
        }
    }
}
Also used : ArduinoLibraryVersion(io.sloeber.core.api.Json.ArduinoLibraryVersion) ArduinoLibraryIndex(io.sloeber.core.api.Json.ArduinoLibraryIndex) ArduinoLibrary(io.sloeber.core.api.Json.ArduinoLibrary)

Aggregations

ArduinoLibrary (io.sloeber.core.api.Json.ArduinoLibrary)2 ArduinoLibraryIndex (io.sloeber.core.api.Json.ArduinoLibraryIndex)2 ArduinoLibraryVersion (io.sloeber.core.api.Json.ArduinoLibraryVersion)2