Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » showView fails to show the view from preShutdown()
showView fails to show the view from preShutdown() [message #557761] Wed, 08 September 2010 14:40 Go to next message
Eclipse User
Originally posted by: steve_lukshides.us.ibm.com

Hi All,
I have an application that requires a message to be displayed to the
user when the user exits the application. The message has a Yes, No and
Cancel button and if the user presses Yes, they are to be brought back
to one of the views that is currently open, although not necessarily the
one that is visible. So I overrode the preShutdown() method in my
ApplicationWorkbenchAdvisor class and display the message from there. If
the user exits via the File -> Exit menu item (which is defined to be
the org.eclipse.ui.file.exit command), it works fine, the view I want to
show is made visible. If the user exits via Alt-F4 or pressing the close
box (red X in upper right corner), the view is not shown. My code for
showing the view is simply:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(MyView.ID);

Does anyone have any idea why I can't show the view when exiting via
Alt-F4 or close box or have a solution? Thanks in advance!

Steve
Re: showView fails to show the view from preShutdown() [message #558137 is a reply to message #557761] Fri, 10 September 2010 06:02 Go to previous messageGo to next message
Martin Klinke is currently offline Martin Klinke
Messages: 80
Registered: July 2009
Member
Steve,

have you tried debugging? Is the code to show the view executed in the
Alt+F4/red X case at all? If not you might need to find a better place
for the code, i.e. a method that is executed in both cases. If the code
is executed then maybe you need to think of another concept.

HTH,
Martin Klinke
Re: showView fails to show the view from preShutdown() [message #558199 is a reply to message #558137] Fri, 10 September 2010 09:39 Go to previous messageGo to next message
Eclipse User
Originally posted by: steve_lukshides.us.ibm.com

Martin,
Thanks for the reply. Yes, the preShutdown() method is executed no
matter which way I exit my app. It also executes from the same thread
in each case. I'm not sure what other kind of concept I could come up
with, do you have any ideas? As far as I know, preShutdown() is where
you're supposed to put code that executes before shutdown is complete;
you also get the chance to veto the shutdown from there. Seems like a
natural fit to me. Maybe there is a bug in Eclipse? By the way, I'm
using 3.6.0.

Steve

Martin Klinke wrote:
> Steve,
>
> have you tried debugging? Is the code to show the view executed in the
> Alt+F4/red X case at all? If not you might need to find a better place
> for the code, i.e. a method that is executed in both cases. If the code
> is executed then maybe you need to think of another concept.
>
> HTH,
> Martin Klinke
>
Re: showView fails to show the view from preShutdown() [message #558204 is a reply to message #558199] Fri, 10 September 2010 09:50 Go to previous messageGo to next message
Martin Klinke is currently offline Martin Klinke
Messages: 80
Registered: July 2009
Member
Steve,
I'm not quite sure what exactly the problem is. Does the veto work in
either case and only the view is not shown if the user decides to
"cancel" the exit procedure after pressing Alt+F4?

Am 10.09.2010 15:39, schrieb Steve Lukshides:
> Martin,
> Thanks for the reply. Yes, the preShutdown() method is executed no
> matter which way I exit my app. It also executes from the same thread in
> each case. I'm not sure what other kind of concept I could come up with,
> do you have any ideas? As far as I know, preShutdown() is where you're
> supposed to put code that executes before shutdown is complete; you also
> get the chance to veto the shutdown from there. Seems like a natural fit
> to me. Maybe there is a bug in Eclipse? By the way, I'm using 3.6.0.
>
> Steve
>
> Martin Klinke wrote:
>> Steve,
>>
>> have you tried debugging? Is the code to show the view executed in the
>> Alt+F4/red X case at all? If not you might need to find a better place
>> for the code, i.e. a method that is executed in both cases. If the
>> code is executed then maybe you need to think of another concept.
>>
>> HTH,
>> Martin Klinke
>>
Re: showView fails to show the view from preShutdown() [message #558277 is a reply to message #558204] Fri, 10 September 2010 14:45 Go to previous message
Eclipse User
Originally posted by: steve_lukshides.us.ibm.com

Yes, the veto works no matter how the app is exited. It's just that the
view is not shown if exiting via Alt-F4 or close box. If exiting via
the menu and vetoed, the view is shown as expected. I copied my original
message into this reply. I think it's pretty clear but if not please
let me know. Thanks for any suggestions you or anyone else may have.

Martin Klinke wrote:
> Steve,
> I'm not quite sure what exactly the problem is. Does the veto work in
> either case and only the view is not shown if the user decides to
> "cancel" the exit procedure after pressing Alt+F4?
>
> Am 10.09.2010 15:39, schrieb Steve Lukshides:
>> Martin,
>> Thanks for the reply. Yes, the preShutdown() method is executed no
>> matter which way I exit my app. It also executes from the same thread in
>> each case. I'm not sure what other kind of concept I could come up with,
>> do you have any ideas? As far as I know, preShutdown() is where you're
>> supposed to put code that executes before shutdown is complete; you also
>> get the chance to veto the shutdown from there. Seems like a natural fit
>> to me. Maybe there is a bug in Eclipse? By the way, I'm using 3.6.0.
>>
>> Steve
>>
>> Martin Klinke wrote:
>>> Steve,
>>>
>>> have you tried debugging? Is the code to show the view executed in the
>>> Alt+F4/red X case at all? If not you might need to find a better place
>>> for the code, i.e. a method that is executed in both cases. If the
>>> code is executed then maybe you need to think of another concept.
>>>
>>> HTH,
>>> Martin Klinke
>>>
>

>Hi All,
>I have an application that requires a message to be displayed to the
>user when the user exits the application. The message has a Yes, No
and >Cancel button and if the user presses Yes, they are to be brought
back >to one of the views that is currently open, although not
necessarily >the one that is visible. So I overrode the preShutdown()
method in my >ApplicationWorkbenchAdvisor class and display the message
from there. >If the user exits via the File -> Exit menu item (which is
defined to >be the org.eclipse.ui.file.exit command), it works fine, the
view I >want to show is made visible. If the user exits via Alt-F4 or
pressing >the close box (red X in upper right corner), the view is not
shown. My >code for showing the view is simply:
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(MyView.ID);
>
>Does anyone have any idea why I can't show the view when exiting via
>Alt-F4 or close box or have a solution? Thanks in advance!
>
>Steve
Previous Topic:JFace/SWT Show Multiple Cell Editors in a Table Column
Next Topic:why ComboViewer starts with blank selection?
Goto Forum:
  


Current Time: Sat Aug 23 07:39:49 EDT 2014

Powered by FUDForum. Page generated in 0.08964 seconds