简体   繁体   中英

Eclipse Plugin RCP: How to pass data between Views

I have an Eclipse Plugin with two views. I would like to pass an ArrayList from one view to the other view. I am OK with a Pull model although an Observor based method would be nice too.

The answer here is the closest I've found after much searching: Passing parameters while showing a view in Eclipse RCP

However, I don't believe it fits my use case.

Put the data in a class that all the views can access.

You could use a singleton class instance managed by the plug-in Activator for example.

If you need to react to changes in class data use listeners to listen for changes to the data. The org.eclipse.core.runtime.ListenerList class provides some code to help with listener lists.

For e4 applications you can use a class annotated with @Creatable and @Singleton and inject it where required. For e4 you can use the Event Broker to broadcast events.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM