Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » SelectEditPartTracker NullPointerException in handleButtonUp
SelectEditPartTracker NullPointerException in handleButtonUp [message #245207] Wed, 27 August 2008 16:00 Go to next message
Lisete  is currently offline Lisete Friend
Messages: 8
Registered: July 2009
Junior Member
I get a NullPointerException in the method handleButtonUp, because
getCurrentViewer() is null.
I want to give the user some feedback about a task that's being performed,
so to report the progress and allow the cancellation, I've used a
ProgressMonitorDialog.
This is the situation: when the user clicks a node in my editor I return
some info about that node. This exception only happens when, after I
select several nodes, I click in one of them... When I click in only one,
the progress bar and all the information are displayed.

I believe this happens because after the progress bar is shown the main
window looses focus and the variable currentViewer (which holds currently
selected objects) is set to null. I just don't understand why... And I
don't understand the different behavior that I described above!! Why,
why?? The progress bar is built in both situations, in both, the variable
currentViewer is set to null...

Can anyone help?

This is the obtained exception:

Caused by: java.lang.NullPointerException
at
org.eclipse.gef.tools.SelectEditPartTracker.handleButtonUp(S electEditPartTracker.java:115)
at
org.eclipse.gef.tools.DragEditPartsTracker.handleButtonUp(Dr agEditPartsTracker.java:336)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1053)
at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.ja va:544)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:259)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainEventDispatcher.java:374)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.java:538)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:206)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
Re: SelectEditPartTracker NullPointerException in handleButtonUp [message #245301 is a reply to message #245207] Tue, 02 September 2008 00:55 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Maybe the progress dialog gets the focus, so there is no graphical viewer?

"Lisete " <lisete.rodrigues.santos@gmail.com> wrote in message
news:ca1cc0791bb58c0c23d0d02b457344ce$1@www.eclipse.org...
>I get a NullPointerException in the method handleButtonUp, because
>getCurrentViewer() is null. I want to give the user some feedback about a
>task that's being performed, so to report the progress and allow the
>cancellation, I've used a ProgressMonitorDialog. This is the situation:
>when the user clicks a node in my editor I return some info about that
>node. This exception only happens when, after I select several nodes, I
>click in one of them... When I click in only one, the progress bar and all
>the information are displayed.
>
> I believe this happens because after the progress bar is shown the main
> window looses focus and the variable currentViewer (which holds currently
> selected objects) is set to null. I just don't understand why... And I
> don't understand the different behavior that I described above!! Why,
> why?? The progress bar is built in both situations, in both, the variable
> currentViewer is set to null...
>
> Can anyone help?
>
> This is the obtained exception:
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.gef.tools.SelectEditPartTracker.handleButtonUp(S electEditPartTracker.java:115)
> at
> org.eclipse.gef.tools.DragEditPartsTracker.handleButtonUp(Dr agEditPartsTracker.java:336)
> at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1053)
> at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.ja va:544)
> at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:259)
> at
> org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainEventDispatcher.java:374)
> at
> org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.java:538)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:206)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
>
>
>
Re: SelectEditPartTracker NullPointerException in handleButtonUp [message #245321 is a reply to message #245301] Wed, 03 September 2008 10:31 Go to previous messageGo to next message
Lisete  is currently offline Lisete Friend
Messages: 8
Registered: July 2009
Junior Member
Hi,
Yes, I've noticed that. But I just don't understand why this
nullPointerException only happens when, after a selection of several
nodes, I click in one of them... When I click in only one (without a
previous "multiple" selection), the progress bar and all the information
are displayed.

In this last situation, the progress dialog also gets the focus and then
there is no graphical viewer, isn't?

I am missing something?
Re: SelectEditPartTracker NullPointerException in handleButtonUp [message #245334 is a reply to message #245321] Wed, 03 September 2008 22:02 Go to previous message
Eclipse UserFriend
Originally posted by: felix.mayer.erdas.com

I don't think you are missing something, I just didn't understand the
problem.

This sounds like a tricky debugging issue to me and not something anybody
here can help you with (of course I may be wrong). I would try to use the
debugger to find out when the graphical viewer is set to null; you might
have to use the enable condition on the breakpoint properties to only
trigger the breakpoint when needed.

"Lisete " <lisete.rodrigues.santos@gmail.com> wrote in message
news:b379f831a86ba22d7438f22f2f1c9ef6$1@www.eclipse.org...
> Hi,
> Yes, I've noticed that. But I just don't understand why this
> nullPointerException only happens when, after a selection of several
> nodes, I click in one of them... When I click in only one (without a
> previous "multiple" selection), the progress bar and all the information
> are displayed.
>
> In this last situation, the progress dialog also gets the focus and then
> there is no graphical viewer, isn't?
>
> I am missing something?
>
Previous Topic:ActionBarContributor vs org.eclipse.ui.popupMenus
Next Topic:Make selection to new Pasted Objects
Goto Forum:
  


Current Time: Wed Apr 24 22:05:22 GMT 2024

Powered by FUDForum. Page generated in 0.02965 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top