Clipboard vs. JEE_COMPATIBILITY [message #1860624] |
Tue, 22 August 2023 11:21  |
Eclipse User |
|
|
|
Hi,
can you think of a way to implement access to the Clipboard from an application, which was created to run in JEE_COMPATIBILITY mode?
We started development several years ago and did not give much thought to the difference.
Do I understand correctly, that the Clipboard is implemented similar to a modal prompt in orderto allow the browser to ask the user's permission to access the clipboard? Isn't something similar possible to be implemented in JEE_COMPATIBILITY mode?
One of our customers (using the Edge browser) complains a lot, that it is not possible to get the "Paste" to work from our custom context menus.
What do you think would be the easiest way to implement this AND what would most benefit the Eclipse RAP project as a whole?
1. Use Clipboard and try to make it work in JEE_COMPATIBILITY using something similar to the Dialog callback API ?
2. Implement the paste function on the Javascript side for the text widget as a pure browser-side action, maybe by using the RWT clipboard implementation?
Appreciate your thoughts on this.
Best regards,
Gunnar Adams
|
|
|
Re: Clipboard vs. JEE_COMPATIBILITY [message #1860635 is a reply to message #1860624] |
Tue, 22 August 2023 14:04   |
Eclipse User |
|
|
|
Hi,
RAP Clipboard implementation is using the Clipboard Web API [1] readText/writeText. Please note that "readText" is forbidden in Firefox. Only in Chrome/Edge you have full read/write access after the permission is granted.
The current implementation does not work in JEE_COMPATIBILITY mode because of the original SWT getContents(Transfer)/setContents(Object[], Transfer[]) API where these two methods are blocking (similar to a modal dialogs). But Clipboard class has also RAP specific readText/writeText public methods, which can be used in JEE_COMPATIBILITY mode.
Best regards,
Ivan
[1] https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
|
|
|
Re: Clipboard vs. JEE_COMPATIBILITY [message #1860643 is a reply to message #1860635] |
Wed, 23 August 2023 08:00   |
Eclipse User |
|
|
|
Thank you very much. Very helpful. I know about the limitation in Firefox, but that should be irrelevant for most of our customers.
Clipboard.readText() and Clipboard.writeText() seem to be package private, though and cannot be called directly. I might be able to re-implement the relevant calls to remoteObject.call() in my code, though.
I am on 3.24. Has something been changed since?
So, the idea would be to create a ClipboardListener issue the readText call and wait for the ClipboardListener to give back the result ?
Thanks and best regards
Gunnar
|
|
|
Re: Clipboard vs. JEE_COMPATIBILITY [message #1860759 is a reply to message #1860643] |
Fri, 01 September 2023 08:00  |
Eclipse User |
|
|
|
Hi,
yes... they a package private (I have them public in my custom development). The ClipboardListener will be notified when readText/writeText is called in JEE_COMPATIBILITY mode.
Maybe you can open an issue (enhancement request) to make them public.
Best regards,
Ivan
|
|
|
Powered by
FUDForum. Page generated in 0.02801 seconds