选中checkedTreeselectionDialog中的所有条目(select all the entries in a checkedTreeselectionDialog)

202 IT屋

I am using org.eclipse.ui.dialogs.CheckedTreeSelectionDialog, to display a list of values. I want to select(check) all the values by default. Can you please let me know how this can be done.

解决方案

You can set which nodes are checked initially (on dialog creation), by using the setInitialElementSelections method.

CheckedTreeSelectionDialog dlg = new CheckedTreeSelectionDialog(shell, 
    new cLabelProvider(), 
    new cContentProvider());
dlg.setInput(model);
dlg.setInitialElementSelections(model.getAllElements());

我正在使用org.eclipse.ui.dialogs.CheckedTreeSelectionDialog来显示值列表。我想默认选择(检查)所有的值。您可以让我知道如何做到这一点。


解决方案

您可以设置最初检查的节点(在对话框创建时) ,通过使用 setInitialElementSelections 方法。



  CheckedTreeSelectionDialog dlg = new CheckedTreeSelectionDialog(shell,
new cLabelProvider(),
new cContentProvider());
dlg.setInput(model);
dlg.setInitialElementSelections(model.getAllElements());

本文地址:IT屋 » 选中checkedTreeselectionDialog中的所有条目