1

I am new by to eclipse RCP. I have an requirement in which, I need to copy some information from any "xyz" editor and paste it to "xyz" editor of another instance of same rcp product. My application already have this copy paste functionality for single instance of the product, for which I am using customised standard ACTION as per my requirement.

I was trying to have something like "Application or Session" scope for web applications, where we can store that information and used it for different instances.

Please let me know, if something else required to understand the requirement.

Thanks in Advance !!!

  • Each RCP will be running in a separate JVM process. So you will have to use some form of inter-process communication. – greg-449 Mar 23 '15 at 13:06
  • I am trying to use "Clipboard" class of RCP, I am not sure, weather it would be solve out my problem or not.. Please let me know if you have any idea over that. – user3675941 Mar 24 '15 at 11:00

1 Answers1

0

As greg-449 mentioned they're running in separate JVMs.

This question is related: inter jvm communication It requires Java 7, which might not be available for you if you're using 3.x Platform.

You could also try opening a socket between the JVMs. However I did not find any out-of-the-box solutions.

You might find examples of a locally shared database, like the Java Derby technology. But it's way too much stack of technology for a copy/paste action, so don't use it.

Community
  • 1
  • 1
Adam Horvath
  • 1,249
  • 1
  • 10
  • 25
  • 1
    I am trying to use "Clipboard" class of RCP, I am not sure, weather it would be solve out my problem or not.. Please let me know if you have any idea over that. – user3675941 Mar 24 '15 at 11:00
  • It would solve your problem. It's a good idea as long as your Action is controlled by a Ctrl+C and Crtl+V keys (or the standard action according to the running platform). Users expect Clipboard to be controlled by these keys or the context menu only. They (or at least I) would feel disappointed otherwise. – Adam Horvath Mar 24 '15 at 17:17
  • I have an custom object which I want to set on clipboard using clipboard.setContents(Object[] data, Transfer[] dataTypes) but not able to set proper Transfer object for this method. Can you please provide any sample code for the same. I have an DadiItem class object which I want to set and retrieve it on paste action at different instance of application. – user3675941 Mar 25 '15 at 08:34
  • This one is a useful example: [link](http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTClipboardExample.htm) - see implementation of `MyTypeTransfer` class in the code. Also, about your `DadiItem`, I've found this on `ByteArrayTransfer` documentation: "If the data you are converting does not map to a byte[], you should sub-class Transfer directly and do your own mapping". – Adam Horvath Mar 25 '15 at 10:46