简体   繁体   English

JFace:如何在TableViewer中的单元格中添加多个选择

[英]JFace: how to add multiple selection to a cell in a TableViewer

This question is about how I could add a multi-selection ComboBoxCellEditor , or a multiple BooleanCellEditor to a cell in a TableViewer . 这个问题是关于如何将多选ComboBoxCellEditor或多个BooleanCellEditorTableViewer的单元格。 The main aim is to have a multi selection in a cell. 主要目的是在一个单元格中进行多项选择。

I am using the snippets at http://wiki.eclipse.org/index.php/JFaceSnippets and http://www.eclipse.org/swt/snippets/ , and I now have a fairly good Table using TableView with all editing supports, label providers, content providers. 我正在使用http://wiki.eclipse.org/index.php/JFaceSnippetshttp://www.eclipse.org/swt/snippets/上的代码段,现在我有了一个使用TableView进行所有编辑的相当不错的Table支持,标签提供者,内容提供者。 Inside the cells I now have a TextCellEditor or a ComboBoxCellEditor . 现在,在单元格内部有一个TextCellEditorComboBoxCellEditor

The thing is: I want a multiple selection, and I don't know how. 问题是:我想要多个选择,但我不知道如何选择。

  1. The code of org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor seems to have multipleselection, but I am having always a java.lang.NoClassDefFoundError while trying to use the external Nebula classes org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor的代码似乎具有多项选择,但是在尝试使用外部Nebula类时,我始终遇到java.lang.NoClassDefFoundError

  2. The JFace snippet Snippet061FakedNativeCellEditor provides me with only one checkbox, and adapting this code to my code is difficult. JFace片段Snippet061FakedNativeCellEditor我提供了一个复选框,并且很难使该代码适应我的代码。

Many thanks. 非常感谢。

  1. You're not adding those nebula JARs/Projects to your buildpath/runtime. 您没有将那些星云JAR /项目添加到您的构建路径/运行时中。

  2. You'll have to extend your own CellEditor . 您必须扩展自己的CellEditor Inside it, you can create basically anything you want, as long as it's a Control . 在其中,您基本上可以创建任何想要的东西,只要它是Control I'm pretty sure you can sneak more than one widget in the createControl protected method of CellEditor . 我很确定您可以在CellEditorcreateControl保护的方法中偷偷使用多个小部件。

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

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