Refactoring of selection elements. Additional minor refactoring. Fixed a bug with...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / NameRelationshipWizardPage.java
index 083ee768628ab360b1cfdd0ad8f111c9b6746482..162626a0428b719f2d427ca1fdd711b6943e7a16 100644 (file)
@@ -21,9 +21,9 @@ import eu.etaxonomy.cdm.model.name.NameRelationshipType;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.RootElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.SelectionType;
-import eu.etaxonomy.taxeditor.ui.selection.NameSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
  * <p>
@@ -39,12 +39,10 @@ public class NameRelationshipWizardPage extends WizardPage implements
 
        private final CdmFormFactory formFactory;
 
-       private NameSelectionElement selection_relatedTo;
+       private EntitySelectionElement<TaxonNameBase> selection_relatedTo;
 
        private TermComboElement<NameRelationshipType> combo_relationshipType;
 
-       private final NameRelationshipDetailSection callingSection;
-
        private final TaxonNameBase entity;
 
        private NameRelationshipType type;
@@ -68,7 +66,6 @@ public class NameRelationshipWizardPage extends WizardPage implements
                super("NameRelationshipWizardPage");
                setTitle("New Name Relationship");
                setDescription(callingSection.getEntity().getTitleCache());
-               this.callingSection = callingSection;
                this.entity = callingSection.getEntity();
                this.formFactory = callingSection.getFormFactory();
 
@@ -89,18 +86,18 @@ public class NameRelationshipWizardPage extends WizardPage implements
 
                Composite control = formFactory.createComposite(parent);
 
-               control.setLayout(CdmFormFactory.LAYOUT(2, false));
+               control.setLayout(LayoutConstants.LAYOUT(2, false));
 
                rootElement = new RootElement(formFactory, control);
 
                combo_relationshipType = formFactory.createTermComboElement(NameRelationshipType.class,
                                                rootElement, "Name Relationship Type", null, SWT.NULL);
 
-               selection_relatedTo = (NameSelectionElement) formFactory
-                               .createSelectionElement(SelectionType.NAME,
+               selection_relatedTo = formFactory
+                               .createSelectionElement(TaxonNameBase.class,
                                                ((NameRelationshipWizard) getWizard())
                                                                .getConversationHolder(), rootElement,
-                                               "Related to", null, NameSelectionElement.DEFAULT,
+                                               "Related to", null, EntitySelectionElement.ALL,
                                                SWT.NULL);
 
                setControl(control);