简体   繁体   中英

How to keep track of the check box selection in tableviewer in eclipse e4

I have two partstacks. In one partstack I have JFace tableviewer with four coulmns with checkbox editing support. In second partstack is for displaying Jfreecharts based on the checkbox selection made in first part. In second part I can add parts(kind of tabs) dynamically. Basically after making selection in checkbox, chart is displayed , if i create a new part then the check box selection should be cleared up and i can select some checkbox and display the chart based on those selection. If I click on the previous part where the first selections are made and graph drawn should remain as it is. Depends on the part currently active, the selections made on the tableviewer should be shown.I am able to display the graph based on selection but I dnt know how to show changes made in check box for the corresponding part.Can any one please suggest some idea? 在此处输入图片说明

You can use the ESelectionService to put the current Selection (and it's attributes) in the TreeViewer part. You can then retrieve the selection in the chart part. Injecting the current selection with @Named(IServiceConstants.ACTIVE_SELECTION) should also work, when the active part changes.

See: http://www.vogella.com/tutorials/Eclipse4Services/article.html#selectionservice

You will then still need to get notified, when an attribute in your selection changes. You could:

  1. Re-Inject a new selection object
  2. Send an event
  3. Use databinding (ie JFace Databinding)

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