- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
-
- viewer = new CheckboxTreeViewer(composite, SWT.NULL);
-
- viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- viewer.setContentProvider(new TermContentProvider());
- viewer.setLabelProvider(new TermLabelProvider());
- // When user checks a checkbox in the tree, check all its children
- viewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- viewer.setSubtreeChecked(event.getElement(), event.getChecked());
- }
- });
-
- List<TermVocabulary<DefinedTermBase>> vocs = CdmStore.getService(IVocabularyService.class).findByTermType(TermType.Feature, null);
- viewer.setInput(vocs);
+ treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
+ treeComposite.getViewer().setComparator(new DefinedTermSorter());
+ treeComposite.getViewer().setInput(vocabularies);
+ treeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ treeComposite.getViewer().addSelectionChangedListener(e->getWizard().getContainer().updateButtons());