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