fix #5702: filter for current name in name details view if select new name
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / NonViralNameDetailSection.java
index 9a02d8f98d514b01315b30a4767b272ca9265ea9..8782002943f5f96008afb5d60278b8257e3289c2 100644 (file)
@@ -26,6 +26,8 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.NameSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -66,12 +68,12 @@ public class NonViralNameDetailSection extends AbstractCdmDetailSection<NonViral
        protected Control createToolbar() {
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
 
-               if(nameChoosable){
+               if(nameChoosable && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
                    //choose name
                    Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
                        @Override
                        public void run() {
-                           TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), null);
+                           TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), getEntity());
                            if(taxonName!=null){
                                if(taxonName.isInstanceOf(NonViralName.class)){
                                    CdmStore.getService(ITaxonNodeService.class).list(TaxonNode.class, null, null, null, null);