mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Now libraries are installed with all the dependencies
This is the base for the GUI that will be introduced in the next commits.
This commit is contained in:
parent
67e38bc80a
commit
07e1518b28
@ -214,11 +214,23 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibraryRelease
|
||||
}
|
||||
|
||||
public void onInstallPressed(final ContributedLibrary lib) {
|
||||
List<ContributedLibrary> deps = BaseNoGui.librariesIndexer.getIndex().resolveDependeciesOf(lib);
|
||||
final boolean installDeps;
|
||||
if (deps.size() > 1) {
|
||||
System.out.println("The library requires dependencies!");
|
||||
installDeps = true;
|
||||
} else {
|
||||
installDeps = false;
|
||||
}
|
||||
clearErrorMessage();
|
||||
installerThread = new Thread(() -> {
|
||||
try {
|
||||
setProgressVisible(true, tr("Installing..."));
|
||||
installer.install(lib, this::setProgress);
|
||||
if (installDeps) {
|
||||
installer.install(deps, this::setProgress);
|
||||
} else {
|
||||
installer.install(lib, this::setProgress);
|
||||
}
|
||||
// TODO: Do a better job in refreshing only the needed element
|
||||
if (contribTable.getCellEditor() != null) {
|
||||
contribTable.getCellEditor().stopCellEditing();
|
||||
|
@ -88,11 +88,19 @@ public class LibraryInstaller {
|
||||
rescanLibraryIndex(progress, progressListener);
|
||||
}
|
||||
|
||||
public synchronized void install(ContributedLibrary lib, ProgressListener progressListener) throws Exception {
|
||||
final MultiStepProgress progress = new MultiStepProgress(4);
|
||||
public void install(ContributedLibrary lib, ProgressListener progressListener) throws Exception {
|
||||
ArrayList<ContributedLibrary> libs = new ArrayList<>();
|
||||
libs.add(lib);
|
||||
install(libs, progressListener);
|
||||
}
|
||||
|
||||
// Do install library (3 steps)
|
||||
performInstall(lib, progressListener, progress);
|
||||
public synchronized void install(List<ContributedLibrary> libs, ProgressListener progressListener) throws Exception {
|
||||
MultiStepProgress progress = new MultiStepProgress(3 * libs.size() + 1);
|
||||
|
||||
for (ContributedLibrary lib : libs) {
|
||||
// Do install library (3 steps)
|
||||
performInstall(lib, progressListener, progress);
|
||||
}
|
||||
|
||||
// Rescan index (1 step)
|
||||
rescanLibraryIndex(progress, progressListener);
|
||||
|
Loading…
Reference in New Issue
Block a user