문제

I am using pure eclipse e4 application. I have created one handler and two parts. Using the handler I selected the files and displayed in one of the part say "Part A". The Part A has a tableviewer with checkboxes. After selecting particular files from the table viewer checkbox , I need to calculate some values from those selected files and display them in some kind of graph in the second part say Part B. I need the selected files in Part B so that I can process those files and using Jfreechart I can display the chart in Part B.

My question is how to pass values from Part A to Part B?

도움이 되었습니까?

해결책

You can use the e4 Event Broker to do this.

In the part that wants to send events inject the event broker:

@Inject
private IEventBroker eventBroker; 

To send data asynchronously use:

eventBroker.post("base_topic/data_event", data); 

to send synchronously use:

eventBroker.send("base_topic/data_event", data); 

In your part that wants to receive the data use:

@Inject
@Optional
void dataEvent(@EventTopic("base_topic/data_event") DataType data) 

if you want the data to be received on the UI thread use @UIEventTopic instead of @EventTopic.

The event topic names are something you decide on, I have just used an example here.

Note: Since this uses injection the code must be in something like an MPart class (or you must do the injection yourself).

More details here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top