Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Clipboard vs. JEE_COMPATIBILITY(Any way to enable Clipboard in JEE_COMPATIBILITY mode?)
Clipboard vs. JEE_COMPATIBILITY [message #1860624] Tue, 22 August 2023 11:21 Go to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
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 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 Go to previous messageGo to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
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 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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
Previous Topic:ToolTip and delay
Next Topic:FileUpload with result possible?
Goto Forum:
  


Current Time: Fri Jun 21 15:23:46 GMT 2024

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

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

Back to the top