use of org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator in project epp.mpc by eclipse.
the class DefaultCatalogService method registerDynamicFavoritesService.
private void registerDynamicFavoritesService(String catalogUrl, String favoritesApiServer, String favoritesApiKey) {
IMarketplaceServiceLocator marketplaceServiceLocator = ServiceHelper.getMarketplaceServiceLocator();
IUserFavoritesService favoritesService = marketplaceServiceLocator.getFavoritesService(catalogUrl);
if (favoritesService != null) {
return;
}
((ServiceLocator) marketplaceServiceLocator).registerFavoritesService(catalogUrl, favoritesApiServer, favoritesApiKey);
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator in project epp.mpc by eclipse.
the class ServiceLocator method getInstance.
/**
* @deprecated acquire the registered {@link IMarketplaceServiceLocator} OSGi service instead.
*/
@Deprecated
public static synchronized ServiceLocator getInstance() {
if (instance != null) {
return instance;
}
IMarketplaceServiceLocator locator = getCompatibilityLocator();
if (locator != null && locator instanceof ServiceLocator) {
// don't remember service instance, it might get deregistered
return (ServiceLocator) locator;
}
// remember new default instance
instance = new ServiceLocator();
return instance;
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator in project epp.mpc by eclipse.
the class ServiceLocator method getCompatibilityLocator.
/**
* This method is not intended to be referenced by clients. Acquire the registered
* {@link IMarketplaceServiceLocator} OSGi service instead.
* <p>
* This method provides legacy compatibility with the ServiceLocator singleton for internal use only. It will return
* the ServiceLocator singleton if it has been set explicitly. Otherwise it will return the registered default
* {@link IMarketplaceServiceLocator} OSGi service.
*
* @noreference This method is not intended to be referenced by clients.
*/
public static synchronized IMarketplaceServiceLocator getCompatibilityLocator() {
if (instance != null) {
return instance;
}
IMarketplaceServiceLocator locator = ServiceHelper.getMarketplaceServiceLocator();
if (locator == null) {
// remember new default instance
instance = new ServiceLocator();
locator = instance;
}
return locator;
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator in project epp.mpc by eclipse.
the class DiscoverNatureSupportJob method run.
@Override
protected IStatus run(IProgressMonitor monitor) {
BundleContext bundleContext = MarketplaceClientUiPlugin.getBundleContext();
ServiceReference<IMarketplaceServiceLocator> locatorReference = bundleContext.getServiceReference(IMarketplaceServiceLocator.class);
IMarketplaceServiceLocator locator = bundleContext.getService(locatorReference);
IMarketplaceService marketplaceService = locator.getDefaultMarketplaceService();
// $NON-NLS-1$]
String fileExtensionTag = "nature_" + natureId;
try {
ISearchResult searchResult = marketplaceService.tagged(fileExtensionTag, monitor);
nodes = searchResult.getNodes();
} catch (CoreException ex) {
IStatus status = new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.LookupByNatureJob_discoveryFailed, natureId), ex);
MarketplaceClientUi.getLog().log(status);
// Do not return this status as it would show an error
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
use of org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator in project epp.mpc by eclipse.
the class DiscoverFileSupportJob method run.
@Override
protected IStatus run(IProgressMonitor monitor) {
BundleContext bundleContext = MarketplaceClientUiPlugin.getBundleContext();
ServiceReference<IMarketplaceServiceLocator> locatorReference = bundleContext.getServiceReference(IMarketplaceServiceLocator.class);
IMarketplaceServiceLocator locator = bundleContext.getService(locatorReference);
IMarketplaceService marketplaceService = locator.getDefaultMarketplaceService();
try {
return run(marketplaceService, monitor);
} finally {
bundleContext.ungetService(locatorReference);
}
}
Aggregations