26
26
import io .sloeber .core .common .Common ;
27
27
import io .sloeber .core .common .ConfigurationPreferences ;
28
28
import io .sloeber .core .common .InstancePreferences ;
29
+ import io .sloeber .core .core .DefaultInstallHandler ;
29
30
import io .sloeber .core .managers .Library ;
30
31
import io .sloeber .core .managers .LibraryIndex ;
31
32
import io .sloeber .core .managers .Manager ;
34
35
35
36
public class LibraryManager {
36
37
static private List <LibraryIndex > libraryIndices ;
38
+ private static IInstallLibraryHandler myInstallLibraryHandler = new DefaultInstallHandler ();
37
39
38
40
static public List <LibraryIndex > getLibraryIndices () {
39
41
if (libraryIndices == null ) {
@@ -237,6 +239,7 @@ public static IStatus setLibraryTree(LibraryTree libs, IProgressMonitor monitor,
237
239
public static String getPrivateLibraryPathsString () {
238
240
return InstancePreferences .getPrivateLibraryPathsString ();
239
241
}
242
+
240
243
public static void setPrivateLibraryPaths (String [] libraryPaths ) {
241
244
InstancePreferences .setPrivateLibraryPaths (libraryPaths );
242
245
@@ -296,9 +299,9 @@ static public void loadJson(File jsonFile) {
296
299
}
297
300
298
301
/**
299
- * Install the latest version of all the libraries belonging to this
300
- * category If a earlier version is installed this version will be removed
301
- * before installation of the newer version
302
+ * Install the latest version of all the libraries belonging to this category If
303
+ * a earlier version is installed this version will be removed before
304
+ * installation of the newer version
302
305
*
303
306
* @param category
304
307
*/
@@ -352,30 +355,37 @@ public static void removeAllLibs() {
352
355
}
353
356
354
357
/**
355
- * Searches for all libraries that can be installed but are not yet installed.
356
- * A library is considered installed when 1 version of the library is installed.
358
+ * Searches for all libraries that can be installed but are not yet installed. A
359
+ * library is considered installed when 1 version of the library is installed.
357
360
*
358
361
* @return a map of all instalable libraries
359
362
*/
360
363
public static Map <String , io .sloeber .core .managers .Library > getAllInstallableLibraries () {
361
364
Map <String , Library > ret = new HashMap <>();
362
365
for (LibraryIndex libraryIndex : libraryIndices ) {
363
- ret .putAll (libraryIndex .getLatestInstallableLibraries ());
366
+ ret .putAll (libraryIndex .getLatestInstallableLibraries ());
364
367
}
365
368
366
369
return ret ;
367
370
}
368
371
369
- public static Map <String , io .sloeber .core .managers .Library > getLatestInstallableLibraries (
370
- Set <String > libnames ) {
371
- Set <String > remainingLibNames =new TreeSet <>(libnames );
372
+ public static Map <String , io .sloeber .core .managers .Library > getLatestInstallableLibraries (Set <String > libnames ) {
373
+ Set <String > remainingLibNames = new TreeSet <>(libnames );
372
374
Map <String , Library > ret = new HashMap <>();
373
375
for (LibraryIndex libraryIndex : libraryIndices ) {
374
- ret .putAll (libraryIndex .getLatestInstallableLibraries (remainingLibNames ));
375
- remainingLibNames .removeAll (ret .keySet ());
376
+ ret .putAll (libraryIndex .getLatestInstallableLibraries (remainingLibNames ));
377
+ remainingLibNames .removeAll (ret .keySet ());
376
378
}
377
379
378
380
return ret ;
379
381
}
380
382
383
+ public static void registerInstallLibraryHandler (IInstallLibraryHandler installLibraryHandler ) {
384
+ myInstallLibraryHandler = installLibraryHandler ;
385
+ }
386
+
387
+ public static IInstallLibraryHandler getInstallLibraryHandler () {
388
+ return myInstallLibraryHandler ;
389
+ }
390
+
381
391
}
0 commit comments