Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » How to set WindowCloseHandler(IWindowCloseHandler set in IEclipseContext doesn't get invoked during close)
How to set WindowCloseHandler [message #1691343] Mon, 06 April 2015 06:21 Go to next message
Eclipse UserFriend
Hi,

I've got a little problem with IWindowCloseHandler in my application.

Set up: efxclipse nightly, Windows 7, JDK8 Update40

Scenario: After the user terminates my RCP application by clicking the exit Button (default exit Button in the RCP 'main' Trimmed Window) the user should be presented with a dialog if he really wants to exit the application.

Therefore I used to add in my former SWT application an IWindowCloseHandler like this:
@Inject
MApplication app;

private void setApplicationExitDialog() {
MWindow window = (MWindow) modelService.find(MY_APP_WINDOW_ID, app);
window.getContext().set(IWindowCloseHandler.class, new MyWindowCloseHandler());
}

When I try this approach in efxclipse "MyWindowCloseHandler" never gets invoked.


public class WindowCloseHandler implements IWindowCloseHandler {

private static final Logger LOGGER = Logger.getLogger(WindowCloseHandler.class.getName());

@Override
public boolean close(MWindow window) {
LOGGER.info("WindowCloseHandler");
return false;
}
}

I would be glad for any advice how to realize a WindowCloseHandler or something similar with efxclipse.
Re: How to set WindowCloseHandler [message #1691372 is a reply to message #1691343] Mon, 06 April 2015 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Looks like we are not honoring this as of today - please file a bug so
that we can fix this with 2.0.

Unfortunately not even our lifecycle stuff is attached to windows
(another "bug") so as of today I'm afraid the only option is to role
your own WindowRenderer (by subclassing DefWindowRenderer) or another
option is to provide custom window-rendering through FXML where you hook
the close button?

Tom

On 06.04.15 12:21, Thomas Schäfer wrote:
> Hi,
> I've got a little problem with IWindowCloseHandler in my application.
> Set up: efxclipse nightly, Windows 7, JDK8 Update40
>
> Scenario: After the user terminates my RCP application by clicking the
> exit Button (default exit Button in the RCP 'main' Trimmed Window) the
> user should be presented with a dialog if he really wants to exit the
> application.
> Therefore I used to add in my former SWT application an
> IWindowCloseHandler like this:
> @Inject
> MApplication app;
>
> private void setApplicationExitDialog() {
> MWindow window = (MWindow) modelService.find(MY_APP_WINDOW_ID, app);
> window.getContext().set(IWindowCloseHandler.class, new
> MyWindowCloseHandler());
> }
>
> When I try this approach in efxclipse "MyWindowCloseHandler" never gets
> invoked.
>
> public class WindowCloseHandler implements IWindowCloseHandler {
>
> private static final Logger LOGGER =
> Logger.getLogger(WindowCloseHandler.class.getName());
>
> @Override
> public boolean close(MWindow window) {
> LOGGER.info("WindowCloseHandler");
> return false;
> }
> }
>
> I would be glad for any advice how to realize a WindowCloseHandler or
> something similar with efxclipse.
Re: How to set WindowCloseHandler [message #1691376 is a reply to message #1691372] Mon, 06 April 2015 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I went ahead, filed the bug [1] and fixed it - as you note the fix is
very simple [2] and if you need that in 1.2.0 you can backport it
yourself or if you'd have support contract with BestSolution.at you
could request a back port and a new build.

Tom

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=463984
[2]http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/commit/?id=494e15e972076b974ce199767977ae327235dbf2

On 06.04.15 19:58, Tom Schindl wrote:
> Looks like we are not honoring this as of today - please file a bug so
> that we can fix this with 2.0.
>
> Unfortunately not even our lifecycle stuff is attached to windows
> (another "bug") so as of today I'm afraid the only option is to role
> your own WindowRenderer (by subclassing DefWindowRenderer) or another
> option is to provide custom window-rendering through FXML where you hook
> the close button?
>
> Tom
>
> On 06.04.15 12:21, Thomas Schäfer wrote:
>> Hi,
>> I've got a little problem with IWindowCloseHandler in my application.
>> Set up: efxclipse nightly, Windows 7, JDK8 Update40
>>
>> Scenario: After the user terminates my RCP application by clicking the
>> exit Button (default exit Button in the RCP 'main' Trimmed Window) the
>> user should be presented with a dialog if he really wants to exit the
>> application.
>> Therefore I used to add in my former SWT application an
>> IWindowCloseHandler like this:
>> @Inject
>> MApplication app;
>>
>> private void setApplicationExitDialog() {
>> MWindow window = (MWindow) modelService.find(MY_APP_WINDOW_ID, app);
>> window.getContext().set(IWindowCloseHandler.class, new
>> MyWindowCloseHandler());
>> }
>>
>> When I try this approach in efxclipse "MyWindowCloseHandler" never gets
>> invoked.
>>
>> public class WindowCloseHandler implements IWindowCloseHandler {
>>
>> private static final Logger LOGGER =
>> Logger.getLogger(WindowCloseHandler.class.getName());
>>
>> @Override
>> public boolean close(MWindow window) {
>> LOGGER.info("WindowCloseHandler");
>> return false;
>> }
>> }
>>
>> I would be glad for any advice how to realize a WindowCloseHandler or
>> something similar with efxclipse.
>
Re: How to set WindowCloseHandler [message #1691446 is a reply to message #1691376] Tue, 07 April 2015 06:30 Go to previous messageGo to next message
Eclipse UserFriend
Thanks a lot for your very fast feedback.
I will try it today.
Re: How to set WindowCloseHandler [message #1691473 is a reply to message #1691446] Tue, 07 April 2015 09:50 Go to previous messageGo to next message
Eclipse UserFriend
No Message Body
Re: How to set WindowCloseHandler [message #1691474 is a reply to message #1691473] Tue, 07 April 2015 09:51 Go to previous message
Eclipse UserFriend
Works like a charme now.
Thx
Previous Topic:onAction event handles is marked as error in FXML
Next Topic:How to check is MPart hiden/closed?
Goto Forum:
  


Current Time: Sun Aug 31 02:54:48 EDT 2025

Powered by FUDForum. Page generated in 0.05288 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top