User Tools

Site Tools


pass_data_from_handler_to_view

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pass_data_from_handler_to_view [2020/03/22 20:31] (current)
mihael created
Line 1: Line 1:
 +====== Pass Data from Handler to View ======
 +If you want to pass data from the handler to the view for processing during the ''​@PostConstruct''​ annotated method then you can add the data to the transient data map.
  
 +<sxh java>
 +part.getTransientData().put(IServiceConstants.ACTIVE_SELECTION,​ selection);
 +</​sxh>​
 +
 +In the ''​@PostConstruct''​ annotated method just inject the part as a parameter to the method and retrieve the data from the map.
 +
 +<sxh java>
 +@PostConstruct
 +public void postConstruct(MPart part, final Composite parent) {
 +
 +    ITreeSelection selection = part.getTransientData().get(IServiceConstants.ACTIVE_SELECTION));​
 +    ...
 +}
 +</​sxh>​
 +
 +{{tag>​eclipse e4}}
pass_data_from_handler_to_view.txt ยท Last modified: 2020/03/22 20:31 by mihael