@@ -69,12 +69,14 @@ public class BoardsManager {
69
69
70
70
private static boolean myIsDirty = true ;
71
71
72
+ private static boolean myIsUpdating =false ;
73
+
72
74
static {
73
75
getPersistentPackageURLList ();
74
76
}
75
77
76
78
public static boolean isReady () {
77
- return !myIsDirty ;
79
+ return !( myIsDirty || myIsUpdating ) ;
78
80
}
79
81
80
82
/**
@@ -178,7 +180,7 @@ public static void setPackageURLs(Collection<String> packageUrls) {
178
180
*/
179
181
public static void installsubsetOfLatestPlatforms (int fromIndex , int toIndex ) {
180
182
String DEPRECATED = "DEPRECATED" ; //$NON-NLS-1$
181
- if (! isReady () ) {
183
+ if (myIsDirty ) {
182
184
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
183
185
return ;
184
186
}
@@ -218,7 +220,7 @@ public static void installAllLatestPlatforms() {
218
220
}
219
221
220
222
public static void installLatestPlatform (String JasonName , String packagerName , String architectureName ) {
221
- if (! isReady () ) {
223
+ if (myIsDirty ) {
222
224
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
223
225
return ;
224
226
}
@@ -379,7 +381,7 @@ private static String[] getHardwarePaths() {
379
381
380
382
public static IStatus updatePlatforms (List <IArduinoPlatformVersion > platformsToInstall ,
381
383
List <IArduinoPlatformVersion > platformsToRemove , IProgressMonitor monitor , MultiStatus status ) {
382
- if (! isReady () ) {
384
+ if (myIsDirty ) {
383
385
status .add (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , null ));
384
386
return status ;
385
387
}
@@ -603,7 +605,7 @@ private static IPath getThirdPartyURLStoragePath() {
603
605
}
604
606
605
607
public static void removeAllInstalledPlatforms () {
606
- if (! isReady () ) {
608
+ if (myIsDirty ) {
607
609
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
608
610
return ;
609
611
}
@@ -678,7 +680,7 @@ public static List<IArduinoPlatformPackageIndex> getPackageIndices() {
678
680
// }
679
681
680
682
public static IArduinoPlatform getPlatform (String vendor , String architecture ) {
681
- if (! isReady () ) {
683
+ if (myIsDirty ) {
682
684
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
683
685
return null ;
684
686
}
@@ -701,7 +703,7 @@ public static IArduinoPlatform getPlatform(String vendor, String architecture) {
701
703
* @return the found platform otherwise null
702
704
*/
703
705
public static IArduinoPlatformVersion getPlatform (IPath platformPath ) {
704
- if (! isReady () ) {
706
+ if (myIsDirty ) {
705
707
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
706
708
return null ;
707
709
}
@@ -739,7 +741,7 @@ public static IArduinoPlatformVersion getPlatform(IPath platformPath) {
739
741
* @return a platform or null if no platforms are installed
740
742
*/
741
743
static public IArduinoPlatformVersion getAnyInstalledPlatform () {
742
- if (! isReady () ) {
744
+ if (myIsDirty ) {
743
745
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
744
746
return null ;
745
747
}
@@ -766,7 +768,7 @@ static private boolean areThereInstalledBoards() {
766
768
767
769
static public List <IArduinoPackage > getPackages () {
768
770
List <IArduinoPackage > packages = new ArrayList <>();
769
- if (! isReady () ) {
771
+ if (myIsDirty ) {
770
772
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
771
773
return packages ;
772
774
}
@@ -801,7 +803,7 @@ static private IArduinoPackage getPackage(String jasonURL, String packageName) {
801
803
* Remove all packages that have a more recent version
802
804
*/
803
805
public static void onlyKeepLatestPlatforms () {
804
- if (! isReady () ) {
806
+ if (myIsDirty ) {
805
807
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
806
808
return ;
807
809
}
@@ -841,7 +843,7 @@ public static IArduinoPlatformVersion getPlatform(String vendor, String architec
841
843
}
842
844
843
845
public static IArduinoPackage getPackageByProvider (String packager ) {
844
- if (! isReady () ) {
846
+ if (myIsDirty ) {
845
847
Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
846
848
return null ;
847
849
}
@@ -868,6 +870,7 @@ public static IArduinoPackage getPackageByProvider(String packager) {
868
870
*/
869
871
public static void update (boolean reloadFromInternet ) {
870
872
synchronized (packageIndices ) {
873
+ myIsUpdating =true ;
871
874
if (myIsDirty ) {
872
875
downloadJsons (reloadFromInternet );
873
876
readJsons ();
@@ -898,9 +901,8 @@ public static void update(boolean reloadFromInternet) {
898
901
}
899
902
envVarsNeedUpdating = false ;
900
903
}
901
-
902
904
}
903
-
905
+ myIsUpdating = false ;
904
906
}
905
907
906
908
}
0 commit comments