|Asking for confirmation before closing an editor [message #1745655]
||Fri, 14 October 2016 06:49
| Vlad Acretoaie
Registered: April 2014
TL;DR: I don't know how to present the user with a confirmation dialog before closing the CompareEditor defined by EMF Compare.
I have a relatively simple use case that I'd like to accommodate: asking the user to confirm they wish to close an editor after they have pressed the close (x) button on the workbench window.
I have determined from other threads on this forum (e.g. https://www.eclipse.org/forums/index.php?t=msg&goto=307349&) that attaching an IPartListener to the window won't help, since its partClosed() method will only be invoked after the window has been closed.
The recommended solution is to implement the ISaveablePart2 interface in the part the user is closing. However, I cannot do this, since the part comes from a plugin. In particular, it is the CompareEditor defined by EMF Compare. So I cannot add any additional interfaces to it. Or, if I somehow can, I don't know how to (extending the class doesn't look like an option, since it is instantiated by another EMF Compare class and not directly by my code).
Another suggestion I saw (https://www.eclipse.org/forums/index.php/t/81813/) is to use an IPerspectiveListener2 instead of the IPartListener, since this listener will be notified before the part is actually closed. However, I still don't know how to abort closing the part from within this listener. Is this even possible?
Thanks in advance,
Powered by FUDForum
. Page generated in 0.02213 seconds