(Resend-first attempt didn't reach the list.)

After input from Jody and a spelunk through the uDig source, I figured out how 
to close maps programmatically.


The below closes all open maps ignoring any edits.  Could be embellished to 
close currently active map by or a subset by calling 
ApplicationGIS.getActiveMap() or .getVisibleMaps(), then looking at 
MapPart.getMap() and comparing to (Map)IMap etc.

        IWorkbenchWindow window = 
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if( window==null ){
            return;
        }
        IWorkbenchPage page = window.getActivePage();
        if( page!=null ){
            IEditorPart[] editorparts = page.getEditors();
            for (IEditorPart editorpart: editorparts) {
                if( editorpart instanceof MapPart ){
                    page.activate(editorpart);
                    page.closeEditor(editorpart, false);
                }
            }
        }
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to