Question

Je crée un JFace ListSelectionDialog comme suit.

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();

et la boîte de dialogue s’affiche correctement.

Cependant, j'aimerais que toutes les cases à cocher soient sélectionnées. Comment je fais ça?

Était-ce utile?

La solution

List elementsToSelect = ...
dialog.setInitialElementSelections(elementsToSelect);

Autres conseils

Vous pouvez sous-classer ListSelectionDialog et ajouter cette méthode:

public void selectAll() {
    getViewer().setAllChecked(true);
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top