[
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".
|
Here's another example of an NPE from a split window and/or
situations where the map isn't currently visible:
LayerImpl.java:
void resetConnection(IResolveDelta delta) {
if( PlatformUI.getWorkbench().isClosing() )
return;
warned=false;
this.geoResources = null;
if( delta.getKind()==Kind.CHANGED ){
// the resource has changed so this means it could have
moved or parameters may have changed
// so set modified on the map so the new params will be
saved on shutdown.
getMapInternal().eResource().setModified(true);
the map is null...
Vince.
At 14:29 07/11/2007, 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
--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.503 / Virus Database:
269.15.23/1114 - Release Date: 06/11/2007 20:05