Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsshowView fails to show the view from preShutdown()
https://www.eclipse.org/forums/index.php/mv/msg/175096/557761/#msg_557761
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:
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]]>2010-09-08T18:40:45-00:00Re: showView fails to show the view from preShutdown()
https://www.eclipse.org/forums/index.php/mv/msg/175096/558137/#msg_558137
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]]>Martin Klinke2010-09-10T10:02:45-00:00Re: showView fails to show the view from preShutdown()
https://www.eclipse.org/forums/index.php/mv/msg/175096/558199/#msg_558199
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
>]]>2010-09-10T13:39:02-00:00Re: showView fails to show the view from preShutdown()
https://www.eclipse.org/forums/index.php/mv/msg/175096/558204/#msg_558204
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
>>]]>Martin Klinke2010-09-10T13:50:41-00:00Re: showView fails to show the view from preShutdown()
https://www.eclipse.org/forums/index.php/mv/msg/175096/558277/#msg_558277
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]]>2010-09-10T18:45:14-00:00