简体   繁体   English

如何在Eclipse E4中跟踪TableViewer中的复选框选择

[英]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. 在一个部分堆栈中,我具有JFace tableviewer,它具有四个带有复选框编辑支持的库伦。 In second partstack is for displaying Jfreecharts based on the checkbox selection made in first part. 在第二部分中,用于根据第一部分中的复选框显示Jfreecharts。 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? 取决于当前活动的零件,应该显示在tableviewer上所做的选择。我能够根据选择显示图形,但我不知道如何显示相应零件的复选框中的更改。任何人都可以建议一些理念? 在此处输入图片说明

You can use the ESelectionService to put the current Selection (and it's attributes) in the TreeViewer part. 您可以使用ESelectionService将当前的Selection(及其属性)放入TreeViewer部分。 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. 当活动零件更改时,也可以使用@Named(IServiceConstants.ACTIVE_SELECTION)注入当前选择。

See: http://www.vogella.com/tutorials/Eclipse4Services/article.html#selectionservice 请参阅: 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) 使用数据绑定(即JFace数据绑定)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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