Figured it out.

This 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