File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
app/src/cc/arduino/contributions/libraries/ui
arduino-core/src/cc/arduino/contributions/libraries Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -214,11 +214,23 @@ protected void onUpdatePressed() {
214
214
}
215
215
216
216
public void onInstallPressed (final ContributedLibrary lib ) {
217
+ List <ContributedLibrary > deps = BaseNoGui .librariesIndexer .getIndex ().resolveDependeciesOf (lib );
218
+ final boolean installDeps ;
219
+ if (deps .size () > 1 ) {
220
+ System .out .println ("The library requires dependencies!" );
221
+ installDeps = true ;
222
+ } else {
223
+ installDeps = false ;
224
+ }
217
225
clearErrorMessage ();
218
226
installerThread = new Thread (() -> {
219
227
try {
220
228
setProgressVisible (true , tr ("Installing..." ));
221
- installer .install (lib , this ::setProgress );
229
+ if (installDeps ) {
230
+ installer .install (deps , this ::setProgress );
231
+ } else {
232
+ installer .install (lib , this ::setProgress );
233
+ }
222
234
// TODO: Do a better job in refreshing only the needed element
223
235
if (contribTable .getCellEditor () != null ) {
224
236
contribTable .getCellEditor ().stopCellEditing ();
Original file line number Diff line number Diff line change @@ -88,11 +88,19 @@ public synchronized void updateIndex(ProgressListener progressListener) throws E
88
88
rescanLibraryIndex (progress , progressListener );
89
89
}
90
90
91
- public synchronized void install (ContributedLibrary lib , ProgressListener progressListener ) throws Exception {
92
- final MultiStepProgress progress = new MultiStepProgress (4 );
91
+ public void install (ContributedLibrary lib , ProgressListener progressListener ) throws Exception {
92
+ ArrayList <ContributedLibrary > libs = new ArrayList <>();
93
+ libs .add (lib );
94
+ install (libs , progressListener );
95
+ }
96
+
97
+ public synchronized void install (List <ContributedLibrary > libs , ProgressListener progressListener ) throws Exception {
98
+ MultiStepProgress progress = new MultiStepProgress (3 * libs .size () + 1 );
93
99
94
- // Do install library (3 steps)
95
- performInstall (lib , progressListener , progress );
100
+ for (ContributedLibrary lib : libs ) {
101
+ // Do install library (3 steps)
102
+ performInstall (lib , progressListener , progress );
103
+ }
96
104
97
105
// Rescan index (1 step)
98
106
rescanLibraryIndex (progress , progressListener );
You can’t perform that action at this time.
0 commit comments