Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Closing/Restarting an already closed workbench.
Closing/Restarting an already closed workbench. [message #335686] Tue, 21 April 2009 18:47
Eclipse UserFriend
Originally posted by: bdom.pub+eclipseng.gmail.com

Hello there.

In our plugin we have a timer thread, and also some modal dialogs (which
pop-up automatically in certain conditions, like network disconnects),
that allow one to close or restart the workbench. However, when this
happens (the timer/modal-dialog closing the workbench), it may cause
other modal dialogs underneath (either from our plugin, or native to
Eclipse UI) that were also open, to close themselves and then attempt to
close/restart the workbench *again*. One such example would be:
org.eclipse.update.internal.ui.UpdateUI.requestRestart(boole an) which
calls PlatformUI.getWorkbench().restart() after its dialog exits, even
if due to a workbench shutdown, because disposing the shell of a modal
dialog will make the dialog return the same code as if the OK button had
been pressed.

However, it happens that closing the workbench when it is already closed
is an illegal operation: it our case it throws a NPE and causes UI
mementos to be incorrectly saved. So I'm trying to prevent this problem
from happening, but I'm not finding a satisfactory way to do it.

When we try to close the workbench in our plugin's modal dialogs, we can
just check if the workbench is already closed before trying to close it
again... but that does nothing to prevent this happening in other
plugin's code, including the platform itself.
Another idea would be to add a IWorkbenchListener to veto shutdowns if
the workbench is already closed... but it doesn't work because on the
fisrt close the listeners are cleared and never called afterwards.
The other idea is to use the WorkbenchAdvisor to veto the shutdown, but
it only works if one is running one's own RCP Application (not to
mention it still sounds like a hackish workaround).

So any other ideas? Or are my assumptions wrong and I should be doing
this in a whole different way?


Cheers,
Bruno Medeiros
Previous Topic:signer information does not match
Next Topic:.classpath behavior
Goto Forum:
  


Current Time: Sat Apr 27 01:21:41 GMT 2024

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

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

Back to the top