@@ -90,7 +90,7 @@ public static void startup_Pluging(IProgressMonitor monitor) {
90
90
loadJsons (ConfigurationPreferences .getUpdateJasonFilesFlag ());
91
91
List <Board > allBoards = getInstalledBoards ();
92
92
if (allBoards .isEmpty ()) { // If boards are installed do nothing
93
- // InstallDefaultLibraries(monitor);
93
+ InstallDefaultLibraries (monitor );
94
94
MyMultiStatus mstatus = new MyMultiStatus ("Failed to configer Sloeber" ); //$NON-NLS-1$
95
95
96
96
// Downnload sample programs
@@ -123,14 +123,18 @@ public static void startup_Pluging(IProgressMonitor monitor) {
123
123
124
124
}
125
125
126
- /*
127
- * private static void InstallDefaultLibraries(IProgressMonitor monitor) {
128
- * LibraryIndex libindex = getLibraryIndex();
129
- *
130
- * for (String library : Defaults.INSTALLED_LIBRARIES) { Library toInstalLib
131
- * = libindex.getLatestLibrary(library); if (toInstalLib != null) {
132
- * toInstalLib.install(monitor); } } }
133
- */
126
+ private static void InstallDefaultLibraries (IProgressMonitor monitor ) {
127
+ LibraryIndex libindex = getLibraryIndex (Defaults .DEFAULT );
128
+ if (libindex == null )
129
+ return ;
130
+
131
+ for (String library : Defaults .INSTALLED_LIBRARIES ) {
132
+ Library toInstalLib = libindex .getLatestLibrary (library );
133
+ if (toInstalLib != null ) {
134
+ toInstalLib .install (monitor );
135
+ }
136
+ }
137
+ }
134
138
135
139
/**
136
140
* Given a platform description in a json file download and install all
@@ -230,9 +234,9 @@ static private void loadJson(String url, boolean forceDownload) {
230
234
}
231
235
}
232
236
if (jsonFile .exists ()) {
233
- if (jsonFile .getName ().startsWith ("package_" )) { //$NON-NLS-1$
237
+ if (jsonFile .getName ().toLowerCase (). startsWith ("package_" )) { //$NON-NLS-1$
234
238
loadPackage (jsonFile );
235
- } else if (jsonFile .getName ().startsWith ("library_" )) { //$NON-NLS-1$
239
+ } else if (jsonFile .getName ().toLowerCase (). startsWith ("library_" )) { //$NON-NLS-1$
236
240
loadLibrary (jsonFile );
237
241
}
238
242
}
@@ -255,7 +259,6 @@ static private void loadLibrary(File jsonFile) {
255
259
try (Reader reader = new FileReader (jsonFile )) {
256
260
LibraryIndex index = new Gson ().fromJson (reader , LibraryIndex .class );
257
261
index .resolve ();
258
- // index.setOwners(null);
259
262
index .setJsonFile (jsonFile );
260
263
libraryIndices .add (index );
261
264
} catch (Exception e ) {
@@ -278,6 +281,15 @@ static public List<LibraryIndex> getLibraryIndices() {
278
281
}
279
282
return libraryIndices ;
280
283
}
284
+
285
+ static public LibraryIndex getLibraryIndex (String name ) {
286
+ for (LibraryIndex index : getLibraryIndices ()) {
287
+ if (index .getName ().equals (name )) {
288
+ return index ;
289
+ }
290
+ }
291
+ return null ;
292
+ }
281
293
282
294
static public Board getBoard (String boardName , String platformName , String packageName ) {
283
295
for (PackageIndex index : getPackageIndices ()) {
@@ -772,7 +784,7 @@ public static int compareVersions(String version1, String version2) {
772
784
if (vi1 > vi2 ) {
773
785
return 1 ;
774
786
}
775
- } catch (NumberFormatException e ) {
787
+ } catch (@ SuppressWarnings ( "unused" ) NumberFormatException e ) {
776
788
// not numbers, do string compares
777
789
int c = v1 [i ].compareTo (v2 [i ]);
778
790
if (c < 0 ) {
0 commit comments