Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Error when Using of Timer
Error when Using of Timer [message #219775] Fri, 21 July 2006 10:41 Go to next message
Eclipse UserFriend
Originally posted by: dstamkokeng.gmail.com

Hi,

I am trying to use a timer to change the location of one of my figure.
However it always cause an error.
Here is the error log. May I know what is the deferredUpdateManager? and
is there anyway I can use a timer or date class of java to update my
figure?

java.lang.NullPointerException
at
org.eclipse.draw2d.DeferredUpdateManager.queueWork(DeferredU pdateManager.java:174)
at
org.eclipse.draw2d.DeferredUpdateManager.addDirtyRegion(Defe rredUpdateManager.java:105)
at org.eclipse.draw2d.Figure.repaint(Figure.java:1323)
at org.eclipse.draw2d.Figure.erase(Figure.java:311)
at org.eclipse.draw2d.Figure.setBounds(Figure.java:1390)
at org.eclipse.draw2d.Figure.setLocation(Figure.java:1546)
at
org.eclipse.gef.examples.shapes.parts.TimeLineOverlayFigure. setLocationOfTimeLine(TimeLineOverlayFigure.java:42)
at
org.eclipse.gef.examples.shapes.parts.ShapeEditPart.refreshT imeLineProp(ShapeEditPart.java:327)
at
org.eclipse.gef.examples.shapes.parts.ShapeEditPart.property Change(ShapeEditPart.java:281)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at
org.eclipse.gef.examples.shapes.model.ModelElement.firePrope rtyChange(ModelElement.java:62)
at
org.eclipse.gef.examples.shapes.model.TimeLineOverlayShape.s tartTimeLine(TimeLineOverlayShape.java:40)
at
org.eclipse.gef.examples.shapes.views.shapeViews$6.run(shape Views.java:292)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Re: Error when Using of Timer [message #219791 is a reply to message #219775] Fri, 21 July 2006 15:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

A Deferred update manager:
/**
* An UpdateManager that asynchronously updates the affected figures.
*/

What version of GEF are you using? Line 174 from head is:
}
not much null pointing going on there.


Cheers,
Ian

Meo Kok Eng wrote:
> Hi,
>
> I am trying to use a timer to change the location of one of my figure.
> However it always cause an error. Here is the error log. May I know what
> is the deferredUpdateManager? and is there anyway I can use a timer or
> date class of java to update my figure?
>
> java.lang.NullPointerException
> at
> org.eclipse.draw2d.DeferredUpdateManager.queueWork(DeferredU pdateManager.java:174)
>
> at
> org.eclipse.draw2d.DeferredUpdateManager.addDirtyRegion(Defe rredUpdateManager.java:105)
>
> at org.eclipse.draw2d.Figure.repaint(Figure.java:1323)
> at org.eclipse.draw2d.Figure.erase(Figure.java:311)
> at org.eclipse.draw2d.Figure.setBounds(Figure.java:1390)
> at org.eclipse.draw2d.Figure.setLocation(Figure.java:1546)
> at
> org.eclipse.gef.examples.shapes.parts.TimeLineOverlayFigure. setLocationOfTimeLine(TimeLineOverlayFigure.java:42)
>
> at
> org.eclipse.gef.examples.shapes.parts.ShapeEditPart.refreshT imeLineProp(ShapeEditPart.java:327)
>
> at
> org.eclipse.gef.examples.shapes.parts.ShapeEditPart.property Change(ShapeEditPart.java:281)
>
> at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
> at
> org.eclipse.gef.examples.shapes.model.ModelElement.firePrope rtyChange(ModelElement.java:62)
>
> at
> org.eclipse.gef.examples.shapes.model.TimeLineOverlayShape.s tartTimeLine(TimeLineOverlayShape.java:40)
>
> at
> org.eclipse.gef.examples.shapes.views.shapeViews$6.run(shape Views.java:292)
> at java.util.TimerThread.mainLoop(Unknown Source)
> at java.util.TimerThread.run(Unknown Source)
>
Re: Error when Using of Timer [message #219881 is a reply to message #219791] Mon, 24 July 2006 00:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dstamkokeng.gmail.com

Hi,

I am using gef 3.1.1.
Re: Error when Using of Timer [message #219886 is a reply to message #219881] Mon, 24 July 2006 06:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

Ok, I think I see the problem (and it will still happen in GEF 3.2, just
in a different place).

protected void queueWork() {
if (!updateQueued) {
Display.getCurrent().asyncExec(new UpdateRequest());
updateQueued = true;
}
}

The getCurrent() is returning null because the thread you are running is
not a user-interface thread for any display.

Does anyone know if GEF should use getDefault() here instead of
getCurrent? Or any other advice for Meo? I guess he could synchronize
with the display, but GEF seems to be doing that already.

Cheers,
Ian

Meo Kok Eng wrote:
> Hi,
> I am using gef 3.1.1.
>
Re: Error when Using of Timer [message #221248 is a reply to message #219886] Fri, 11 August 2006 02:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dstamkokeng.gmail.com

Hi,

Ya, the problem lies there.

java.lang.NullPointerException
at
org.eclipse.draw2d.DeferredUpdateManager.queueWork(DeferredU pdateManager.java:174)
at
org.eclipse.draw2d.DeferredUpdateManager.addDirtyRegion(Defe rredUpdateManager.java:105)
at org.eclipse.draw2d.Figure.repaint(Figure.java:1323)
at org.eclipse.draw2d.Figure.erase(Figure.java:311)
at org.eclipse.draw2d.Figure.setBounds(Figure.java:1390)
at org.eclipse.draw2d.Figure.setLocation(Figure.java:1546)


In DeferredUpdateManager.addDirtyRegion, it will call queueWork if the
figure is visible. I tried setting my figure to not visible and the timer
works well, changing the location of my figure. However I need the figure
to be visible :(
Anybody has any idea how do I go about this problem or is there anyway for
me get around it?

Thanks!
Re: Error when Using of Timer [message #221264 is a reply to message #219886] Fri, 11 August 2006 04:30 Go to previous message
Eclipse UserFriend
Originally posted by: dstamkokeng.gmail.com

Hi,

I have change the Display.getCurrent()to Display.getDefault() and my
figures are finally showing and changing location :) But the old image of
the figure continue to remain there for a while. Is there any method to
remove them away?
Thanks alot Ian.

Ian Bull wrote:

> Ok, I think I see the problem (and it will still happen in GEF 3.2, just
> in a different place).

> protected void queueWork() {
> if (!updateQueued) {
> Display.getCurrent().asyncExec(new UpdateRequest());
> updateQueued = true;
> }
> }

> The getCurrent() is returning null because the thread you are running is
> not a user-interface thread for any display.

> Does anyone know if GEF should use getDefault() here instead of
> getCurrent? Or any other advice for Meo? I guess he could synchronize
> with the display, but GEF seems to be doing that already.

> Cheers,
> Ian

> Meo Kok Eng wrote:
>> Hi,
>> I am using gef 3.1.1.
>>
Previous Topic:Multiple Property Change Commands w/ EMF.Edit
Next Topic:ScrollPane is not scrolling!
Goto Forum:
  


Current Time: Fri Jan 24 17:41:50 GMT 2025

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

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

Back to the top