JFace的问题:如何选择一个ListSelectionDialog的所有项目?
-
20-08-2019 - |
题
我创建的JFace ListSelectionDialog如下。
final ListSelectionDialog dialog = new ListSelectionDialog(
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
List<SomeClass>,
new ArrayContentProvider(),
new LabelProvider(),
""); //$NON-NLS-1$
dialog.setTitle("Dialog Title"); //$NON-NLS-1$
dialog.setMessage("SomeMessage"); //$NON-NLS-1$
dialog.open();
和所述对话框显示了罚款。
要被选择然而,我想所有的复选框。 我该怎么做呢?
解决方案
List elementsToSelect = ...
dialog.setInitialElementSelections(elementsToSelect);
其他提示
可以子类ListSelectionDialog并添加此方法:
public void selectAll() {
getViewer().setAllChecked(true);
}
不隶属于 StackOverflow