1919import java .io .FileReader ;
2020import java .io .IOException ;
2121import java .io .InputStream ;
22- import java .io .InputStreamReader ;
2322import java .io .Reader ;
2423import java .net .HttpURLConnection ;
2524import java .net .MalformedURLException ;
2625import java .net .URL ;
27- import java .nio .charset .Charset ;
2826import java .nio .file .Files ;
2927import java .nio .file .Path ;
3028import java .nio .file .Paths ;
3634import java .util .Map ;
3735import java .util .Set ;
3836
39- import javax .net .ssl .HttpsURLConnection ;
40-
4137import org .apache .commons .compress .archivers .ArchiveEntry ;
4238import org .apache .commons .compress .archivers .ArchiveInputStream ;
4339import org .apache .commons .compress .archivers .tar .TarArchiveEntry ;
@@ -93,7 +89,7 @@ public static void startup_Pluging(IProgressMonitor monitor) {
9389 loadJsons (ConfigurationPreferences .getUpdateJasonFilesFlag ());
9490 List <Board > allBoards = getInstalledBoards ();
9591 if (allBoards .isEmpty ()) { // If boards are installed do nothing
96- // InstallDefaultLibraries(monitor);
92+ InstallDefaultLibraries (monitor );
9793 MyMultiStatus mstatus = new MyMultiStatus ("Failed to configer Sloeber" ); //$NON-NLS-1$
9894
9995 // Downnload sample programs
@@ -126,16 +122,18 @@ public static void startup_Pluging(IProgressMonitor monitor) {
126122
127123 }
128124
129- /* private static void InstallDefaultLibraries(IProgressMonitor monitor) {
130- LibraryIndex libindex = getLibraryIndex();
125+ private static void InstallDefaultLibraries (IProgressMonitor monitor ) {
126+ LibraryIndex libindex = getLibraryIndex (Defaults .DEFAULT );
127+ if (libindex == null )
128+ return ;
131129
132130 for (String library : Defaults .INSTALLED_LIBRARIES ) {
133131 Library toInstalLib = libindex .getLatestLibrary (library );
134132 if (toInstalLib != null ) {
135133 toInstalLib .install (monitor );
136134 }
137135 }
138- }*/
136+ }
139137
140138 /**
141139 * Given a platform description in a json file download and install all
@@ -260,7 +258,6 @@ static private void loadLibrary(File jsonFile) {
260258 try (Reader reader = new FileReader (jsonFile )) {
261259 LibraryIndex index = new Gson ().fromJson (reader , LibraryIndex .class );
262260 index .resolve ();
263- // index.setOwners(null);
264261 index .setJsonFile (jsonFile );
265262 libraryIndices .add (index );
266263 } catch (Exception e ) {
@@ -283,6 +280,15 @@ static public List<LibraryIndex> getLibraryIndices() {
283280 }
284281 return libraryIndices ;
285282 }
283+
284+ static public LibraryIndex getLibraryIndex (String name ) {
285+ for (LibraryIndex index : getLibraryIndices ()) {
286+ if (index .getName ().equals (name )) {
287+ return index ;
288+ }
289+ }
290+ return null ;
291+ }
286292
287293 static public Board getBoard (String boardName , String platformName , String packageName ) {
288294 for (PackageIndex index : getPackageIndices ()) {
0 commit comments