import org.eclipse.swt.widgets.Composite;
import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
-import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
public class AvailableFeaturesWizardPage extends WizardPage {
private CheckBoxTreeComposite treeComposite;
- private TermType termType;
+ private List<TermVocabularyDto> vocabularies;
- protected AvailableFeaturesWizardPage(TermType termType) {
+ protected AvailableFeaturesWizardPage(List<TermVocabularyDto> vocabularies, boolean singleSelection) {
super("Available Terms Wizard Page");
- this.termType = termType;
+ this.vocabularies = vocabularies;
setTitle("Available Terms");
- setDescription("Please select terms you want to add to the tree.");
+ if(singleSelection){
+ setDescription("Please select one single term");
+ }
+ else{
+ setDescription("Please select terms.");
+ }
}
/** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
- List<TermVocabularyDto> vocabularyDtos = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(termType);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
- treeComposite.getViewer().setInput(vocabularyDtos);
+ treeComposite.getViewer().setInput(vocabularies);
treeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ treeComposite.getViewer().addSelectionChangedListener(e->getWizard().getContainer().updateButtons());
setControl(treeComposite);
}