Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Showing dialog window before closing the view
Showing dialog window before closing the view [message #641669] Fri, 26 November 2010 11:02 Go to next message
Julian  is currently offline Julian
Messages: 5
Registered: November 2010
Junior Member
Hi all,
I one of my view in eclipse RCP application i have a variable representing if any changes were done.
Before leaving the window (by clicking X of that view) I would like to show simple message window yes/now with question if the user really want to close that view. Where should I make kind of listener or are there any ready function?
kindly regards
julian
Re: Showing dialog window before closing the view [message #641891 is a reply to message #641669] Mon, 29 November 2010 02:21 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 11/26/2010 17:02, Julian wrote:
> Hi all,
> I one of my view in eclipse RCP application i have a variable
> representing if any changes were done.
> Before leaving the window (by clicking X of that view) I would like to
> show simple message window yes/now with question if the user really want
> to close that view. Where should I make kind of listener or are there
> any ready function?
> kindly regards
> julian

Just override WorkbenchAdvisor#preShutdown which returns a boolean. Here
you can do anything necessary (like opening a dialog) to let the user
decide, whether (s)he really wants to exit the application. Just return
false, if no exit is wanted.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Showing dialog window before closing the view [message #641896 is a reply to message #641669] Mon, 29 November 2010 03:06 Go to previous messageGo to next message
Julian  is currently offline Julian
Messages: 5
Registered: November 2010
Junior Member
Yes, that's working but for whole window of application, but I was looking for something for only one view.
Re: Showing dialog window before closing the view [message #641898 is a reply to message #641896] Mon, 29 November 2010 03:13 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 11/29/2010 09:06, Julian wrote:
> Yes, that's working but for whole window of application, but I was
> looking for something for only one view.

Oops, sorry, I misread. Have you considered to let your view implement
ISaveablePart?

HTH & Greetings from Bremen,

Daniel Krügler
Re: Showing dialog window before closing the view [message #641918 is a reply to message #641669] Mon, 29 November 2010 04:24 Go to previous message
Julian  is currently offline Julian
Messages: 5
Registered: November 2010
Junior Member
thanks, that solution is perfect
Previous Topic:Disable Tree item
Next Topic:Setting input on default perspective
Goto Forum:
  


Current Time: Sat Apr 19 13:19:23 EDT 2014

Powered by FUDForum. Page generated in 0.02401 seconds