19
19
import java .io .FileReader ;
20
20
import java .io .IOException ;
21
21
import java .io .InputStream ;
22
- import java .io .InputStreamReader ;
23
22
import java .io .Reader ;
24
23
import java .net .HttpURLConnection ;
25
24
import java .net .MalformedURLException ;
26
25
import java .net .URL ;
27
- import java .nio .charset .Charset ;
28
26
import java .nio .file .Files ;
29
27
import java .nio .file .Path ;
30
28
import java .nio .file .Paths ;
36
34
import java .util .Map ;
37
35
import java .util .Set ;
38
36
39
- import javax .net .ssl .HttpsURLConnection ;
40
-
41
37
import org .apache .commons .compress .archivers .ArchiveEntry ;
42
38
import org .apache .commons .compress .archivers .ArchiveInputStream ;
43
39
import org .apache .commons .compress .archivers .tar .TarArchiveEntry ;
@@ -93,7 +89,7 @@ public static void startup_Pluging(IProgressMonitor monitor) {
93
89
loadJsons (ConfigurationPreferences .getUpdateJasonFilesFlag ());
94
90
List <Board > allBoards = getInstalledBoards ();
95
91
if (allBoards .isEmpty ()) { // If boards are installed do nothing
96
- // InstallDefaultLibraries(monitor);
92
+ InstallDefaultLibraries (monitor );
97
93
MyMultiStatus mstatus = new MyMultiStatus ("Failed to configer Sloeber" ); //$NON-NLS-1$
98
94
99
95
// Downnload sample programs
@@ -126,16 +122,18 @@ public static void startup_Pluging(IProgressMonitor monitor) {
126
122
127
123
}
128
124
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 ;
131
129
132
130
for (String library : Defaults .INSTALLED_LIBRARIES ) {
133
131
Library toInstalLib = libindex .getLatestLibrary (library );
134
132
if (toInstalLib != null ) {
135
133
toInstalLib .install (monitor );
136
134
}
137
135
}
138
- }*/
136
+ }
139
137
140
138
/**
141
139
* Given a platform description in a json file download and install all
@@ -260,7 +258,6 @@ static private void loadLibrary(File jsonFile) {
260
258
try (Reader reader = new FileReader (jsonFile )) {
261
259
LibraryIndex index = new Gson ().fromJson (reader , LibraryIndex .class );
262
260
index .resolve ();
263
- // index.setOwners(null);
264
261
index .setJsonFile (jsonFile );
265
262
libraryIndices .add (index );
266
263
} catch (Exception e ) {
@@ -283,6 +280,15 @@ static public List<LibraryIndex> getLibraryIndices() {
283
280
}
284
281
return libraryIndices ;
285
282
}
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
+ }
286
292
287
293
static public Board getBoard (String boardName , String platformName , String packageName ) {
288
294
for (PackageIndex index : getPackageIndices ()) {
0 commit comments