| Bug in AbstractConnectionCreationTool reactivation? [message #78296] | 
Wed, 07 May 2003 07:44  | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: lauri.pesonen.iki.fi 
 
Basically I get a NullPointerException from 
 
TargetingTool.updateTargetUnderMouse()  
 
[more specifically in 
EditPart editPart = getCurrentViewer().findObjectAtExcluding(... 
 
getViewer() returns a null.] 
 
 
I'm drawing a connection from a node to another node. My implementation 
spawns a dialog box for the user to select the output the connection 
represents in the source node. The dialog is inherited from the JFace 
dialog class. When I click on OK and move the mouse, the 
NullPointerException is thrown.  
 
This does not occur when I create a node and a similar JFace dialog is 
spawned. And this did not happen with the 2.0 version of GEF. I think that 
the reason might be that the connection creation tools are left 'on' while 
node creation tools are reset after use.  
 
I debugged the code and found out that AbstractTool.reactivate() is 
called. reactivate() calls first deactivate() and then 
activate(). deactivate() sets the currentViewer of the tool to null, but 
activate() does not reset it to the current viewer.  
 
The call stack goes something like this (other stuff is called in between): 
 
AbstractTool.mouseMove() 
	AbstractConnectionCreationTool.handleButtonUp() 
		AbstractTool.handleFinished() 
			AbstractTool.reactivate() 
	AbstractConnectionCreationTool.handleMove() 
		TargetingTool.updateTargetUnderMouse() 
			AbstractTool.getCurrentViewer() // returns null and causes the NPE. 
 
 
So, my guess is that the reactivation of the connection creation tool is 
broken and should reset the currentViewer to the current viewer where the 
tool is active.  
 
If this is not the case, I have some really weird bug in my code and I'd 
very much appreciate all the help you can give me :) 
 
--  
  Lauri
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.05453 seconds