import org.eclipse.jface.wizard.Wizard;
+import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.description.Feature;
/**
private Set<Feature> additionalFeatures;
- public AvailableFeaturesWizard(){
+ private TermType termType;
+
+ public AvailableFeaturesWizard(TermType termType){
+ this.termType = termType;
}
/** {@inheritDoc} */
@Override
public void addPages() {
- page = new AvailableFeaturesWizardPage();
+ page = new AvailableFeaturesWizardPage(termType);
addPage(page);
}
public class AvailableFeaturesWizardPage extends WizardPage {
private CheckBoxTreeComposite treeComposite;
+ private TermType termType;
- protected AvailableFeaturesWizardPage() {
+ protected AvailableFeaturesWizardPage(TermType termType) {
super("AvailableFeaturesWizardPage");
+ this.termType = termType;
setTitle("Available Features");
setDescription("Please select features you want to add to the tree.");
}
@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.Feature);
+ List<TermVocabularyDto> vocabularyDtos = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(termType);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
treeComposite.getViewer().setInput(vocabularyDtos);
GridLayoutFactory.fillDefaults().applyTo(treeComposite);
*/
package eu.etaxonomy.taxeditor.featuretree.e4.handler;
-import java.util.List;
+import java.util.Collection;
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.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.taxeditor.featuretree.TermChooseWizard;
+import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
}
FeatureNode parent = (FeatureNode)selection.getFirstElement();
- TermChooseWizard wizard = new TermChooseWizard(parent.getTermType());
+// TermChooseWizard wizard = new TermChooseWizard(parent.getTermType());
+// WizardDialog dialog = new WizardDialog(shell, wizard);
+//
+// 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);
+// }
+// }
+
+ AvailableFeaturesWizard wizard = new AvailableFeaturesWizard(parent.getTermType());
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == IStatus.OK) {
- List<TermDto> selectedTerms = wizard.getSelectedTerms();
- for (TermDto termDto: selectedTerms) {
- AddFeatureOperation operation = new AddFeatureOperation(termDto.getUuid(), parent, editor, editor);
+ Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
+ for (Feature feature : additionalFeatures) {
+ AddFeatureOperation operation = new AddFeatureOperation(feature.getUuid(), parent, editor, editor);
AbstractUtility.executeOperation(operation, sync);
}
}
*/
package eu.etaxonomy.taxeditor.featuretree.e4.handler;
-import java.util.List;
+import java.util.Collection;
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.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.taxeditor.featuretree.TermChooseWizard;
+import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
return;
}
FeatureTree tree = (FeatureTree) selection.getFirstElement();
+//
+// TermChooseWizard wizard = new TermChooseWizard(tree.getTermType());
+// WizardDialog dialog = new WizardDialog(shell, wizard);
+//
+// if (dialog.open() == IStatus.OK) {
+// List<TermDto> selectedTerms = wizard.getSelectedTerms();
+// for (TermDto termDto: selectedTerms) {
+// AddFeatureOperation operation = new AddFeatureOperation(termDto.getUuid(), tree.getRoot(), editor, editor);
+// AbstractUtility.executeOperation(operation, sync);
+// }
+// }
- TermChooseWizard wizard = new TermChooseWizard(tree.getTermType());
+ AvailableFeaturesWizard wizard = new AvailableFeaturesWizard(tree.getTermType());
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == IStatus.OK) {
- List<TermDto> selectedTerms = wizard.getSelectedTerms();
- for (TermDto termDto: selectedTerms) {
- AddFeatureOperation operation = new AddFeatureOperation(termDto.getUuid(), tree.getRoot(), editor, editor);
+ Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
+ for (Feature feature : additionalFeatures) {
+ AddFeatureOperation operation = new AddFeatureOperation(feature.getUuid(), tree.getRoot(), editor, editor);
AbstractUtility.executeOperation(operation, sync);
}
}