eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Command+Q on Snippet99

Open elsazac opened this issue 1 year ago • 2 comments

Fixes: https://github.com/eclipse-platform/eclipse.platform.swt/issues/1205

Snippet99 requires modification as Command+Q is not implemented on that. Currently, the snippet demonstrates a message box pop-up when attempting to close the dialog window, but pressing Command+Q closes the window without triggering this behaviour. The snippet has been updated to implement Command+Q functionality and to add an SWT dispose listener to the display object.

elsazac avatar Sep 23 '24 17:09 elsazac

Test Results

   483 files  ±0     483 suites  ±0   8m 11s ⏱️ +13s  4 135 tests ±0   4 125 ✅ ±0   7 💤 ±0  3 ❌ ±0  16 333 runs  ±0  16 240 ✅ ±0  90 💤 ±0  3 ❌ ±0 

For more details on these failures, see this check.

Results for commit 4ad37b7e. ± Comparison against base commit 69071692.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Sep 23 '24 18:09 github-actions[bot]

But this doesn't demonstrate what is being asked in https://github.com/eclipse-platform/eclipse.platform.swt/issues/1205

As said in this comment:

a dispose listener on the Display object will be called after the shell is closed, so attempting to cancel the dispose event will not prevent the shell being closed.

So in this PR pressing Command+Q will open the dialog but choosing "No" has no effect. i.e event.doit = false has no effect on the dispose event.

Phillipus avatar Oct 04 '24 12:10 Phillipus

But this doesn't demonstrate what is being asked in #1205

So in this PR pressing Command+Q will open the dialog but choosing "No" has no effect. i.e event.doit = false has no effect on the dispose event.

I just noticed that while the snippet shows the message box, it doesn't prevent the app from quitting when Command+Q is pressed. Since in macOS, Command+Q is handled at the OS level, even though the SWT.Dispose event listener can trigger the message box, it doesn't have control over stopping the closing of the shell process triggered by the system. So, the application closes right after the message box appears, regardless of the any other choice.

I tried implementing the keydown event for Command and Q, but this doesn't work either because macOS takes over this key combination before it reaches the SWT application.

Does anyone have any other suggestions on how to handle this situation effectively?

elsazac avatar Oct 24 '24 09:10 elsazac

Will this one be finished or it should be closed?

akurtakov avatar Jan 29 '25 13:01 akurtakov

Closing as there seems to be no interest in finishing it.

akurtakov avatar Apr 08 '25 18:04 akurtakov