Hi,

the problem is that the local catalog does not contain the mapgraphic
service at the moment of your call.
The method getById does not load the service, it just searches if the
passed service id matches any loaded service.
So, before the call to getById, use the acquire method to make sure that
the service is loaded in the catalog:

local.acquire(MapGraphicService.SERVICE_URL, null);

And add the net.refractions.udig.mapgraphic plugin, in your plugin as
dependency.

-Panagiotis

On Tue, Sep 25, 2012 at 4:56 PM, thomas dolley <[email protected]>wrote:

> Hello,
>
> I have build one view,  this view display a map and add  some decoration
> like the legend ( programmaticly ).
> I have added a menu to udig to open this view  ( My Tool> Open My View).
> It works fines at the first start,  but if I close udig  and restart when
>  displaying my view then I have an error(NullPointerException).
>
> I use the following code in the createPartControl method of my view
>
> ..............................**..........
>
> //find georessource corresponding to the Legend
>
> IRepository local = CatalogPlugin.getDefault().**getLocal();
> final ID LEGEND = new ID("mapgraphic:/localhost/**
> mapgraphic#legend",null);
> IGeoResource legendRessource = local.getById(IGeoResource.**class,
> LEGEND, new NullProgressMonitor());
>
> ..............................**..........
>
> legendRessource  is null after restarting due to the fact that IRepository
> local  has no MapgraphicService.
> Do you have any idea why we have this problem ?
>
>
> Best regards
> Thomas
>
> --
> Thomas DOLLEY
>
> ______________________________**_________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/**mailman/listinfo/udig-devel<http://lists.refractions.net/mailman/listinfo/udig-devel>
>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to