use of org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategy method dispose.
@Override
public void dispose() {
List<LoginListener> loginListeners = this.loginListeners;
this.loginListeners = null;
if (loginListeners != null) {
IUserFavoritesService favoritesService = marketplaceService.getUserFavoritesService();
if (favoritesService != null) {
IMarketplaceStorageService storageService = favoritesService.getStorageService();
for (LoginListener loginListener : loginListeners) {
storageService.removeLoginListener(loginListener);
}
}
}
if (source != null) {
source.dispose();
source = null;
}
if (marketplaceInfo != null) {
final MarketplaceInfo fMarketplaceInfo = marketplaceInfo;
new Job(Messages.MarketplaceDiscoveryStrategy_saveMarketplaceInfoJobName) {
{
setSystem(true);
setPriority(SHORT);
setUser(false);
}
@Override
public boolean belongsTo(Object family) {
BundleContext bundleContext = MarketplaceClientUiPlugin.getBundleContext();
MarketplaceClientUiPlugin plugin = MarketplaceClientUiPlugin.getInstance();
return (bundleContext != null && (family == bundleContext || family == bundleContext.getBundle())) || (plugin != null && family == plugin);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
fMarketplaceInfo.save();
} catch (Exception e) {
return MarketplaceClientCore.computeStatus(e, Messages.MarketplaceDiscoveryStrategy_failedToSaveMarketplaceInfo);
}
return Status.OK_STATUS;
}
}.schedule();
marketplaceInfo = null;
}
super.dispose();
}
Aggregations