use of org.eclipse.userstorage.internal.StorageService in project epp.mpc by eclipse.
the class MarketplaceStorageService method cleanupExtraStorageService.
private static IStorageService cleanupExtraStorageService(IStorageService service, IStorageService extraService) {
IStorageService.Dynamic removeDynamic;
IStorageService keepService;
if (extraService instanceof IStorageService.Dynamic) {
removeDynamic = (IStorageService.Dynamic) extraService;
keepService = service;
} else if (service instanceof IStorageService.Dynamic) {
removeDynamic = (IStorageService.Dynamic) service;
keepService = extraService;
} else {
return service;
}
if (removeDynamic instanceof StorageService && keepService instanceof StorageService) {
StorageService removeImpl = (StorageService) removeDynamic;
StorageService keepImpl = (StorageService) keepService;
ISecurePreferences removeSecurePreferences = removeImpl.getSecurePreferences();
ISecurePreferences keepSecurePreferences = keepImpl.getSecurePreferences();
try {
copySecurePreferences(removeSecurePreferences, keepSecurePreferences);
} catch (Exception e) {
MarketplaceClientCore.error(NLS.bind("Failed to migrate secure storage values from {0} to {1}", removeDynamic.getServiceURI(), keepService.getServiceURI()), e);
}
}
removeDynamic.remove();
return keepService;
}
use of org.eclipse.userstorage.internal.StorageService in project epp.mpc by eclipse.
the class UserFavoritesServiceTest method assureService.
private static void assureService() {
StorageService service = StorageServiceRegistry.INSTANCE.getService(USERSTORAGE_SERVICE_URI);
if (service == null) {
StorageServiceRegistry.INSTANCE.addService("Staging", USERSTORAGE_SERVICE_URI);
service = StorageServiceRegistry.INSTANCE.getService(USERSTORAGE_SERVICE_URI);
}
assertNotNull(service);
}
Aggregations