*/
package eu.etaxonomy.taxeditor.featuretree.e4.handler;
-import java.util.Collection;
+import java.util.List;
import javax.inject.Named;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureNode;
-import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.featuretree.TermChooseWizard;
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
if (StoreUtil.promptCheckIsDirty(editor)) {
return;
}
+ FeatureNode parent = (FeatureNode)selection.getFirstElement();
- AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
+ TermChooseWizard wizard = new TermChooseWizard(parent.getTermType());
WizardDialog dialog = new WizardDialog(shell, wizard);
- Object next = selection.getFirstElement();
- if (dialog.open() == IStatus.OK && next instanceof FeatureNode) {
- FeatureNode parent = (FeatureNode)next;
- Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
- for (Feature feature : additionalFeatures) {
- AddFeatureOperation operation = new AddFeatureOperation(feature.getUuid(), parent, editor, editor);
+ if (dialog.open() == IStatus.OK) {
+ List<TermDto> selectedTerms = wizard.getSelectedTerms();
+ for (TermDto termDto: selectedTerms) {
+ AddFeatureOperation operation = new AddFeatureOperation(termDto.getUuid(), parent, editor, editor);
AbstractUtility.executeOperation(operation, sync);
}
}