use of io.sloeber.core.api.Json.ArduinoLibraryVersion 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.ArduinoLibraryVersion in project arduino-eclipse-plugin by Sloeber.
the class LibrarySelectionPage method performOk.
@Override
public boolean performOk() {
if (this.isJobRunning == true) {
// $NON-NLS-1$
MessageDialog.openInformation(// $NON-NLS-1$
getShell(), // $NON-NLS-1$
"Library Manager", // $NON-NLS-1$
"Library Manager is busy. Please wait some time...");
return false;
}
this.isJobRunning = true;
Job job = new Job(Messages.ui_Adopting_arduino_libraries) {
@Override
protected IStatus run(IProgressMonitor monitor) {
MultiStatus status = new MultiStatus(PLUGIN_ID, 0, Messages.ui_installing_arduino_libraries, null);
Set<ArduinoLibraryVersion> toRemoveLibs = new HashSet<>();
Set<ArduinoLibraryVersion> toInstallLibs = new HashSet<>();
for (Category category : libs.categories.values()) {
for (Library library : category.libraries.values()) {
ArduinoLibraryVersion installedVersion = library.getInstalledVersion();
ArduinoLibraryVersion toInstalVersion = library.getVersion();
if ((installedVersion != null) && (installedVersion.compareTo(toInstalVersion) != 0)) {
toRemoveLibs.add(installedVersion);
}
if ((toInstalVersion != null) && (toInstalVersion.compareTo(installedVersion) != 0)) {
toInstallLibs.add(toInstalVersion);
}
}
}
return LibraryManager.updateLibraries(toRemoveLibs, toInstallLibs, monitor, status);
}
};
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
LibrarySelectionPage.this.isJobRunning = false;
}
});
job.setUser(true);
job.schedule();
return true;
}
Aggregations