Could you run with -consoleLog so that the exceptions printed to the console are more verbose, or attach the .log file. I'm afraid I can't tell too much from this message because I don't know the exception that occurred.

ApplicationGIS.getActiveMap returns the map contained in the topmost open editor. If there are no editors open then it will return null.

Jesse
On 22-Mar-06, at 6:44 AM, M.S.Bachler wrote:

Hi!

I am trying to use map.eResource().getURI().

The code is in one of my IWorkbenchWindowActionDelegate classes:

        public void run(IAction action) {
                
                System.out.println("In New Map Action");
                System.out.flush();
                
                URI mapURI = null;
                Map map = null;
                try {
                        map = (Map)ApplicationGIS.getActiveMap();
                        System.out.println("map="+map);
                        System.out.flush();
                        
                        URI projectURI =
map.getProjectInternal().eResource().getURI();
                        System.out.println("project file="+projectURI);
                        System.out.flush();
                                                
                        mapURI = map.eResource().getURI();
                        System.out.println("Map URI="+mapURI);
                        System.out.flush();
                } catch (Exception e) {
                        e.printStackTrace();
                }               

I get the following error when it gets to line "map =
(Map)ApplicationGIS.getActiveMap();":

        In New Map Action
        Unhandled event loop exception
        Reason:

I am sure I was not getting this error before.

Any thoughts about what would cause this?
Is there another way of accessing the current map, not using
ApplicationGIS?

Michelle

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jesse
Eichar
Sent: 21 March 2006 15:12
To: User-friendly Desktop Internet GIS
Subject: Re: [udig-devel] Shapefiles


You can get it by calling map.eResource().getURI().  But I'm curious
why you need it?

Jesse


On 21-Mar-06, at 4:31 AM, M.S.Bachler wrote:

Hi!

Can anyone tell me how to get the uri (actual file path), for a map
file
(.umap).
I have figured out how to get the project file path for the current
project:

                Map map = (Map)ApplicationGIS.getActiveMap();
                URI projectURI =
map.getProjectInternal().eResource().getURI();

But have not yet worked out how to get the uri for the map itself. I
think it is something like:

        URI mapID = ?.getMapID();
        URI mapURI =
map.getProjectInternal().eResource().getResourceSet().getResource
(mapID,
true).getURI();

But I am not sure where I get the MapID from?

Anyone have a clue?

Michelle
_______________________________________________
User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net
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
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
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