Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Marketplace Client Project » IMarketplaceServiceLocator.getDefaultFavoritesService() returns null
IMarketplaceServiceLocator.getDefaultFavoritesService() returns null [message #1752170] Thu, 19 January 2017 12:41 Go to next message
Andreas Sewe is currently offline Andreas SeweFriend
Messages: 111
Registered: June 2013
Senior Member
Hi,

I am trying to write an (E4-style) command handler that makes use of the various I*Services offered by the org.eclipse.epp.mpc.core bundle:

@Execute
public void execute(IMarketplaceServiceLocator locator) {
	IMarketplaceService marketplaceService = locator.getDefaultMarketplaceService();
	IUserFavoritesService favoritesService = locator.getDefaultFavoritesService();
}

When the above handler is executed, the IMarketplaceServiceLocator is injected just fine. Also, I am able to obtain an IMarketplaceService. The IUserFavoritesService, however, is null.

This changes only if, before executing the command, I manually open the marketplace client.

How to ensure that, when my handler is executed, that all necessary services are registered already?

Best wishes,

Andreas
Re: IMarketplaceServiceLocator.getDefaultFavoritesService() returns null [message #1752733 is a reply to message #1752170] Thu, 26 January 2017 16:17 Go to previous messageGo to next message
Carsten Reckord is currently offline Carsten ReckordFriend
Messages: 27
Registered: June 2012
Junior Member
Hi Andreas,

This happens because the "default" favorites service isn't all that default at the moment.

With the marketplace service, MPC has the base URL configured statically as the default (unless overridden in the service registry). We currently don't do this for the favorites service though, because we treat it as a "subordinate" service to the respective marketplace. So the "default favorites service" is actually the favorites service belonging to the default marketplace.

And this is where the problem happens: the favorites services for the known marketplaces are dynamically registered when first reading the marketplace catalog index (see DefaultCatalogService.registerDynamicFavoritesService(Catalog))

Now that the server address and API has stabilized, I could imagine statically registering a proper "default favorites service" corresponding to the default marketplace.

Until then, you should be able to just read the catalog index to initialize the known services properly as follows:

locator.getCatalogService().listCatalogs(monitor);
IUserFavoritesService favoritesService = locator.getDefaultFavoritesService();//this should be non-null now


I'll add some more API doc to getDefaultFavoritesService() to document this and look into registering a real default favorites service (to be overridable from the catalog index or the service registry) for Oxygen.
Re: IMarketplaceServiceLocator.getDefaultFavoritesService() returns null [message #1752775 is a reply to message #1752733] Fri, 27 January 2017 08:16 Go to previous message
Andreas Sewe is currently offline Andreas SeweFriend
Messages: 111
Registered: June 2013
Senior Member
Hi Carsten,

thank you, the listCatalogs trick worked fine ...

Quote:
With the marketplace service, MPC has the base URL configured statically as the default (unless overridden in the service registry). We currently don't do this for the favorites service though, because we treat it as a "subordinate" service to the respective marketplace. So the "default favorites service" is actually the favorites service belonging to the default marketplace.

... and this nicely explains why. Smile
Previous Topic:Cannot add a new solution to eclipse marketplace
Next Topic:Percentage of installed base or installs by Eclipse version/release?
Goto Forum:
  


Current Time: Wed Apr 24 17:44:14 GMT 2024

Powered by FUDForum. Page generated in 0.03186 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top