*/
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.FeatureTree;
-import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
-import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor;
+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;
import eu.etaxonomy.taxeditor.store.StoreUtil;
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, UISynchronize sync) {
- FeatureTreeEditor editor = ((FeatureTreeEditor) thisPart.getObject());
+ IFeatureTreeEditor editor = ((IFeatureTreeEditor) thisPart.getObject());
- if (StoreUtil.checkDirty(editor)) {
+ if (StoreUtil.promptCheckIsDirty(editor)) {
return;
}
- AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
+ TermChooseWizard wizard = new TermChooseWizard();
+ // AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == IStatus.OK) {
FeatureTree tree = (FeatureTree) selection.getFirstElement();
- Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
- for (Feature feature : additionalFeatures) {
- AddFeatureOperation operation = new AddFeatureOperation(feature, tree.getRoot(), editor, editor);
+ List<TermDto> selectedTerms = wizard.getSelectedTerms();
+ for (TermDto termDto: selectedTerms) {
+ AddFeatureOperation operation = new AddFeatureOperation(termDto.getUuid(), tree.getRoot(), editor, editor);
AbstractUtility.executeOperation(operation, sync);
}
}
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
MHandledMenuItem menuItem) {
boolean canExecute = false;
- canExecute = thisPart.getObject() instanceof FeatureTreeEditor
+ canExecute = thisPart.getObject() instanceof IFeatureTreeEditor
&& selection!=null
&& selection.size()==1
&& selection.getFirstElement() instanceof FeatureTree;