Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] split editing windows => null pointer exception in "zoom to layer".

Noted.  Thanks Vince.

Jesse

On 7-Nov-07, at 6:29 AM, Vince Darley wrote:

I get a bunch of exceptions with split windows. It seems code like this is to blame:

RenderManagerAdapters.java:

               case RenderPackage.VIEWPORT_MODEL__BOUNDS: {
if( ApplicationGISInternal.getActiveEditor().isVisible() )
                       refreshDirtyArea(msg);
                   break;
               }

   public static MapEditor getActiveEditor() {
       try{
final ArrayList<IEditorPart> editor = new ArrayList<IEditorPart>();

           PlatformGIS.syncInDisplayThread(
               new Runnable() {
                   public void run() {
                       try {
                           editor.add(
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                               .getActivePage().getActiveEditor()
                           );
                       }
...
           if (editor.get(0) instanceof MapEditor) {
               return (MapEditor)editor.get(0);
           }
...
               return null;

with a split window, if the non-map page is active, but the map is still entirely visible, then getActiveEditor() will return null, and a null pointer exception will be thrown in RenderManagerAdapters and my event (right-click on layer and zoom-to-layer) will do nothing at all.

It seems to me that getActiveEditor() probably needs to be rewritten to get the most recent MapEditor that was active, or at least check if a map editor is visible even if it is not active. Realistically 'zoom to layer' ought to work on the last active map, since I might trigger that action even if I can't currently see the map (but am about to make it active).

regards,

Vince.


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top