@@ -69,12 +69,14 @@ public class BoardsManager {
6969
7070 private static boolean myIsDirty = true ;
7171
72+ private static boolean myIsUpdating =false ;
73+
7274 static {
7375 getPersistentPackageURLList ();
7476 }
7577
7678 public static boolean isReady () {
77- return !myIsDirty ;
79+ return !( myIsDirty || myIsUpdating ) ;
7880 }
7981
8082 /**
@@ -178,7 +180,7 @@ public static void setPackageURLs(Collection<String> packageUrls) {
178180 */
179181 public static void installsubsetOfLatestPlatforms (int fromIndex , int toIndex ) {
180182 String DEPRECATED = "DEPRECATED" ; //$NON-NLS-1$
181- if (! isReady () ) {
183+ if (myIsDirty ) {
182184 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
183185 return ;
184186 }
@@ -218,7 +220,7 @@ public static void installAllLatestPlatforms() {
218220 }
219221
220222 public static void installLatestPlatform (String JasonName , String packagerName , String architectureName ) {
221- if (! isReady () ) {
223+ if (myIsDirty ) {
222224 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
223225 return ;
224226 }
@@ -379,7 +381,7 @@ private static String[] getHardwarePaths() {
379381
380382 public static IStatus updatePlatforms (List <IArduinoPlatformVersion > platformsToInstall ,
381383 List <IArduinoPlatformVersion > platformsToRemove , IProgressMonitor monitor , MultiStatus status ) {
382- if (! isReady () ) {
384+ if (myIsDirty ) {
383385 status .add (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , null ));
384386 return status ;
385387 }
@@ -603,7 +605,7 @@ private static IPath getThirdPartyURLStoragePath() {
603605 }
604606
605607 public static void removeAllInstalledPlatforms () {
606- if (! isReady () ) {
608+ if (myIsDirty ) {
607609 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
608610 return ;
609611 }
@@ -678,7 +680,7 @@ public static List<IArduinoPlatformPackageIndex> getPackageIndices() {
678680// }
679681
680682 public static IArduinoPlatform getPlatform (String vendor , String architecture ) {
681- if (! isReady () ) {
683+ if (myIsDirty ) {
682684 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
683685 return null ;
684686 }
@@ -701,7 +703,7 @@ public static IArduinoPlatform getPlatform(String vendor, String architecture) {
701703 * @return the found platform otherwise null
702704 */
703705 public static IArduinoPlatformVersion getPlatform (IPath platformPath ) {
704- if (! isReady () ) {
706+ if (myIsDirty ) {
705707 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
706708 return null ;
707709 }
@@ -739,7 +741,7 @@ public static IArduinoPlatformVersion getPlatform(IPath platformPath) {
739741 * @return a platform or null if no platforms are installed
740742 */
741743 static public IArduinoPlatformVersion getAnyInstalledPlatform () {
742- if (! isReady () ) {
744+ if (myIsDirty ) {
743745 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
744746 return null ;
745747 }
@@ -766,7 +768,7 @@ static private boolean areThereInstalledBoards() {
766768
767769 static public List <IArduinoPackage > getPackages () {
768770 List <IArduinoPackage > packages = new ArrayList <>();
769- if (! isReady () ) {
771+ if (myIsDirty ) {
770772 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
771773 return packages ;
772774 }
@@ -801,7 +803,7 @@ static private IArduinoPackage getPackage(String jasonURL, String packageName) {
801803 * Remove all packages that have a more recent version
802804 */
803805 public static void onlyKeepLatestPlatforms () {
804- if (! isReady () ) {
806+ if (myIsDirty ) {
805807 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
806808 return ;
807809 }
@@ -841,7 +843,7 @@ public static IArduinoPlatformVersion getPlatform(String vendor, String architec
841843 }
842844
843845 public static IArduinoPackage getPackageByProvider (String packager ) {
844- if (! isReady () ) {
846+ if (myIsDirty ) {
845847 Activator .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , BoardsManagerIsBussy , new Exception ()));
846848 return null ;
847849 }
@@ -868,6 +870,7 @@ public static IArduinoPackage getPackageByProvider(String packager) {
868870 */
869871 public static void update (boolean reloadFromInternet ) {
870872 synchronized (packageIndices ) {
873+ myIsUpdating =true ;
871874 if (myIsDirty ) {
872875 downloadJsons (reloadFromInternet );
873876 readJsons ();
@@ -898,9 +901,8 @@ public static void update(boolean reloadFromInternet) {
898901 }
899902 envVarsNeedUpdating = false ;
900903 }
901-
902904 }
903-
905+ myIsUpdating = false ;
904906 }
905907
906908}
0 commit comments