我创建的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);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top