Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Control over close button on Part tab
Control over close button on Part tab [message #1015249] Wed, 27 February 2013 16:39 Go to next message
Jo Jaquinta is currently offline Jo Jaquinta
Messages: 40
Registered: January 2013
Location: Boston
Member

I have a part that encapsulates a task. When you are setting up the task, and when it is displaying the task results, I wish the part to be closeable. When the task is running, I want the part either not to be closeable, or else to have the ability to interrupt, and possibly abort the close request. (I.e. pop up an "Are you sure?" dialog, and respond.)
I thought by setting MPart.setClosable() I could, at least, enable/disable the close state. But it seems to have no effect once the part is rendered.
And I can't find any API that lets me hook into the closing process.
Any suggestions?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jo Grant, Senior Software Engineer
Admin and Config Console Architect
OpenPages, IBM
Re: Control over close button on Part tab [message #1015581 is a reply to message #1015249] Fri, 01 March 2013 04:32 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 596
Registered: December 2010
Senior Member

Does this help? http://www.eclipse.org/forums/index.php/m/848560/
Re: Control over close button on Part tab [message #1015663 is a reply to message #1015581] Fri, 01 March 2013 10:13 Go to previous message
Jo Jaquinta is currently offline Jo Jaquinta
Messages: 40
Registered: January 2013
Location: Boston
Member

Well, the code there words as advertised. But there are two problems:

1) The handler does not seem to be called unless the tab for the part is in focus.
If I just click on the "X", my handlers does not get called. If I click first on the tab title, then the "X", it does get called.
[Actually, it's more complex than that. I'm not sure what it is anymore.]

2) This doesn't give me any control over the close button. I can see when the user tries to close it. I can even pop up a message that asked them if they really want to do that. But, if they don't, I don't see any way to stop the close from happening.
Is there a way to mark an event as "consumed"? Or otherwise abort it?
I looked to see if I could change NEW_VALUE, but there is no way to set the property.
I tried just going back and setting Visible=true on the model part, but that didn't work. Either immediately or after a pause.
I tried just throwing an exception to crash out the event processing (!), but you've done the right thing and catch all exceptions.

How can I abort a close?

(pure e4, no compatability layer stuff needed, BTW)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jo Grant, Senior Software Engineer
Admin and Config Console Architect
OpenPages, IBM
Previous Topic:Reset perspective though command for perspective created by application model not showing any part i
Next Topic:E4 - Bind handler to regular SWT button (considering canExecute)
Goto Forum:
  


Current Time: Tue Jul 22 07:37:52 EDT 2014

Powered by FUDForum. Page generated in 0.01513 seconds