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() {
214214 }
215215
216216 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+ }
217225 clearErrorMessage ();
218226 installerThread = new Thread (() -> {
219227 try {
220228 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+ }
222234 // TODO: Do a better job in refreshing only the needed element
223235 if (contribTable .getCellEditor () != null ) {
224236 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
8888 rescanLibraryIndex (progress , progressListener );
8989 }
9090
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 );
9399
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+ }
96104
97105 // Rescan index (1 step)
98106 rescanLibraryIndex (progress , progressListener );
You can’t perform that action at this time.
0 commit comments