Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » IProgressService.busyCursorWhile and event queue
IProgressService.busyCursorWhile and event queue [message #436123] Wed, 31 August 2005 12:33 Go to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
Hello,

recently I stumbled about the interaction of busyCursorWhile and the
event queue of the relevant target system (which is WinXP).

If you see in the shortened log file below, we have an data base
application that provides an UI-related ActiveEntityManager, which
is e.g. accessible by a special entity navigation action
(AbstractEntityNavigationDelegate below), which notifies interested
active entity listeners (like the GelViewer below) on changes.

The below documented exception is raised, if the user **quickly**
applies UI entity navigation (by clicking at the toolbar action
one after the other).

To explain the situation somewhat more detailed:

- ActiveEntityManager.fireActiveEntityChanged acts in the same thread as
the AbstractEntityNavigationDelegate, I assume that should be the UI
thread
- Gelviewer.handleEntityChange is the active entity change handler and
starts busyCursorWhile, because there mainly is some Non-UI-stuff to
do, but the user should get some progress feedback. During this
work there is also some call of getDisplay().syncExec() to immediatly
ensure sync with UI parts
- As you see, suddenly we have a ModalContextThread.block. That is fine,
the documentation of busyCursorWhile tells us about that to happen.
- Now the nasty side: **During** the mentioned block the UI event queue
proceeds with the next action invocation of the user, and by doing
this it **also** visits ActiveEntityManager.fireActiveEntityChanged.
The actual runtime exception is fired by this Manager class on any
entry retrial (before previous have finished)

The question arises: What is the correct way to combine event queue with
progress service? My understanding was that busyCursorWhile blocks the
UI, but seems that this does not prevent the event queue from running.

Thanks for any input,

Daniel Krügler



!SESSION 2005-08-31 11:37:30.637
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_04
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US

[..]

!ENTRY org.eclipse.ui 4 0 2005-08-31 11:37:59.700
!MESSAGE Illegal access to locked active entity manager
!STACK 0
java.lang.RuntimeException: Illegal access to locked active entity manager
at
WhatEver.ui.entities.internal.ActiveEntityManager$ActiveEnti tyHistory.gotoEntry(ActiveEntityManager.java:155)
at
WhatEver.ui.entities.internal.ActiveEntityManager$ActiveEnti tyHistory.gotoPrev(ActiveEntityManager.java:141)
at
WhatEver.ui.entities.internal.EntityHistoryActionImpl.run(En tityHistoryActionImpl.java:112)
at
WhatEver.ui.entities.internal.AbstractEntityNavigationDelega te.run(AbstractEntityNavigationDelegate.java:80)
at
org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDel egate.java:70)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:236)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:223)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread. block(ModalContext.java:153)

at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:303)
at
org.eclipse.jface.dialogs.ProgressMonitorDialog.run(Progress MonitorDialog.java:447)
at
org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.r un(ProgressMonitorJobsDialog.java:261)
at
org.eclipse.ui.internal.progress.ProgressManager$3.run(Progr essManager.java:861)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:69)
at
org.eclipse.ui.internal.progress.ProgressManager.busyCursorW hile(ProgressManager.java:895)
at
org.eclipse.ui.internal.progress.ProgressManager.busyCursorW hile(ProgressManager.java:871)
at
WhatEver.ui.gelviewer.views.Gelviewer.handleEntityChange(Gel viewer.java:420)
at WhatEver.ui.gelviewer.views.Gelviewer.access$3(Gelviewer.jav a:380)
at
WhatEver.ui.gelviewer.views.Gelviewer$3.entityChanged(Gelvie wer.java:193)
at
WhatEver.ui.entities.internal.ActiveEntityManager.fireActive EntityChanged(ActiveEntityManager.java:312)
at
WhatEver.ui.entities.internal.ActiveEntityManager$ActiveEnti tyHistory.gotoEntry(ActiveEntityManager.java:163)
at
WhatEver.ui.entities.internal.ActiveEntityManager$ActiveEnti tyHistory.gotoPrev(ActiveEntityManager.java:141)
at
WhatEver.ui.entities.internal.EntityHistoryActionImpl.run(En tityHistoryActionImpl.java:112)
at
WhatEver.ui.entities.internal.AbstractEntityNavigationDelega te.run(AbstractEntityNavigationDelegate.java:80)
at
org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDel egate.java:70)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:236)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:223)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
at WhatEver.ui.ProteinScapeApp.run(ProteinScapeApp.java:60)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
Re: IProgressService.busyCursorWhile and event queue [message #436172 is a reply to message #436123] Thu, 01 September 2005 15:43 Go to previous messageGo to next message
Boris Bokowski is currently offline Boris BokowskiFriend
Messages: 272
Registered: July 2009
Senior Member
I guess you need to synchronize access to your entity manager. How about
setting a boolean flag in either EntityHistoryActionImpl.run() or
AbstractEntityNavigationDelegate.run() that this action is currently
running, and returning early if it is already running?

The event queue needs to be processed during busyCursorWhile() so that the
Cancel button in the progress dialog is responsive.

Boris

"Daniel Kr
Re: IProgressService.busyCursorWhile and event queue [message #436233 is a reply to message #436172] Fri, 02 September 2005 10:46 Go to previous message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
Boris Bokowski wrote:
> I guess you need to synchronize access to your entity manager. How about
> setting a boolean flag in either EntityHistoryActionImpl.run() or
> AbstractEntityNavigationDelegate.run() that this action is currently
> running, and returning early if it is already running?
>
> The event queue needs to be processed during busyCursorWhile() so that the
> Cancel button in the progress dialog is responsive.

Thank you for your explanation and hints, Boris!

My alternative workaround, which would disable the action(s) during
entity setting operation, seems too costly compared to your much more
simpler approach. It seems that the simplicity is acceptable because it
seems quite unnatural, that the user would recognize a missing action
invocation in the described scenario.

Greetings from Bremen,

Daniel Krügler
Previous Topic:Need help with search in Help
Next Topic:RCP WebStart problem - ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
Goto Forum:
  


Current Time: Sun Dec 08 19:55:16 GMT 2024

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

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

Back to the top