fix #6342: fix exception when using ? in selection dialog
authorKatja Luther <k.luther@bgbm.org>
Thu, 19 Jan 2017 09:39:41 +0000 (10:39 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 19 Jan 2017 09:39:41 +0000 (10:39 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AgentSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ClassificationSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NameSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalReferenceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java

index afed317ecf90ac2e50ad082fba33631bd04cbb44..d4f686399b85cb0e5763f919f2b46d8b3d1591c5 100644 (file)
@@ -45,7 +45,7 @@ public class AgentSelectionDialog extends
         *
         */
        protected static final String TEAM = "Team";
-       
+
        protected static boolean selectTeamMember;
 
        /**
@@ -146,9 +146,11 @@ public class AgentSelectionDialog extends
         if (control != null){
             pattern = ((Text)control).getText();
         }
-
-
-               model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+        if (pattern == null || pattern.equals("?")){
+            model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(null, null);
+        }else{
+            model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+        }
        }
 
 
index b856e83f140200c4118aa49ca058711b8a8253de..25046d85fd7c1f32cd847ecf0d3bfe8e92e7b114 100644 (file)
@@ -121,9 +121,12 @@ public class ClassificationSelectionDialog extends
             pattern = ((Text)control).getText();
         }
 
+        if (pattern.equals("?")){
+            model = CdmStore.getService(IClassificationService.class).getUuidAndTitleCache(null, null);
+        }else{
+            model = CdmStore.getService(IClassificationService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+        }
 
-               model = CdmStore.getService(IClassificationService.class)
-                               .getUuidAndTitleCache(limitOfInitialElements, pattern);
        }
 
        /** {@inheritDoc} */
index b42a1e4048f7822cc4ac3d0fc1c2fbaf5f51cdc0..f614f95b4805dba01377080c74f194e7e7aa91d9 100644 (file)
@@ -54,8 +54,11 @@ public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDia
             pattern = ((Text)control).getText();
         }
 
-
-               model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+        if (pattern.equals("?")){
+            model = CdmStore.getService(INameService.class).getUuidAndTitleCache(null, null);
+        }else{
+            model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+        }
        }
 
        /** {@inheritDoc} */
index 44254edf4ca15087c7d7d8bf088925b0a4d0d187..88cffafd38ec741d2f6d1bdccc0969e20ab977c3 100644 (file)
@@ -13,31 +13,11 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection;
 import java.text.Collator;
 import java.util.Comparator;
 
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
 import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
 import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.StyledCellLabelProvider;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
-import org.eclipse.ui.internal.WorkbenchImages;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
@@ -50,9 +30,6 @@ import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
 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.AbstractFilteredCdmResourceSelectionDialog.FilteredCdmResourceLabelProvider;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.CdmFilteredItemsSelectionDialog.ItemsFilter;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.CdmFilteredItemsSelectionDialog.ItemsListSeparator;
 
 /**
  * @author k.luther
@@ -83,8 +60,11 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
         if (control != null){
             pattern = ((Text)control).getText();
         }
-
-        model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, null);
+        if (pattern == null || pattern.equals("?")){
+            model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(null, null, null);
+        }else{
+            model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, null);
+        }
     }
 
     /** {@inheritDoc} */
@@ -145,9 +125,9 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
                 " supports cdmObject of type IIdentifiableEntity." +
                 " Please implement specific method in subclass.");
     }
-   
-    
-    
+
+
+
     public class FilteredCdmResourceAbbrevLabelProvider extends LabelProvider {
                @Override
                public String getText(Object element) {
@@ -166,7 +146,7 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
             return abbrevTitleCache;
                }
        };
-       
+
        /** {@inheritDoc} */
        @Override
        protected ItemsFilter createFilter() {
@@ -192,21 +172,21 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
                                if(item instanceof UuidAndTitleCache){
                                        if (((UuidAndTitleCache) item).getAbbrevTitleCache() != null){
                                                abbrevTitleCache = ((UuidAndTitleCache) item).getAbbrevTitleCache();
-                                       } 
+                                       }
                                        if (((UuidAndTitleCache) item).getTitleCache() != null ){
                                                textTitleCache = ((UuidAndTitleCache) item).getTitleCache();
                                        }
                                }else if(item instanceof String){
                                        textTitleCache = (String) item;
                                }
-                               
+
                                return  (matches(textTitleCache) || matches(abbrevTitleCache)) ;
-                               
+
                        }
 
                };
        }
-       
+
        @Override
        protected Comparator getItemsComparator() {
                return new Comparator<UuidAndTitleCache>() {
@@ -221,8 +201,8 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
                                if (entity1.getTitleCache() != null){
                                        compareString1 += entity1.getTitleCache();
                                }
-                               
-                               
+
+
                                String compareString2 = "";
                                if (entity2.getAbbrevTitleCache() != null){
                                        compareString2 = entity2.getAbbrevTitleCache();
@@ -230,8 +210,8 @@ public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog {
                                if (entity2.getTitleCache() != null){
                                        compareString2 += entity2.getTitleCache();
                                }
-                               
-                               
+
+
                                return collator.compare(compareString1, compareString2);
                        }
                };
index ae72855696b2a5488bfe708714e37bc8caf483ae..6309647e2b0d964de0bf13d9c1f7683c25b3b00c 100644 (file)
@@ -39,8 +39,11 @@ public class NomenclaturalReferenceSelectionDialog extends
             pattern = ((Text)control).getText();
         }
 
-
-               model = CdmStore.getService(IReferenceService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern);
+        if (pattern == null || pattern.equals("?")){
+            model = CdmStore.getService(IReferenceService.class).getUuidAndAbbrevTitleCache(null, null);
+        }else{
+            model = CdmStore.getService(IReferenceService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern);
+        }
        }
 
        /**
index fefdf785004dfffdc5b60ab0e77d08a4fa2faf7b..9c8a64f61293871b3fcb3a7196fa898d2cf5f89d 100644 (file)
@@ -18,7 +18,6 @@ import org.eclipse.swt.widgets.Text;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy;
 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
 import eu.etaxonomy.taxeditor.newWizard.NewReferenceWizard;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -82,8 +81,11 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti
             pattern = ((Text)control).getText();
         }
 
-
-               model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern);
+        if (pattern.equals("?")){
+            model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(null,null);
+        }else{
+            model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern);
+        }
        }
 
 
index 58d144db850b00b0f8e2f8bab3e0b36442c96ed3..eac5330a67284cfa85369009b19a7da591e3e1ec 100644 (file)
@@ -21,7 +21,6 @@ import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
 import eu.etaxonomy.taxeditor.newWizard.NewTaxonWizard;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -79,9 +78,11 @@ public class TaxonBaseSelectionDialog extends AbstractFilteredCdmResourceSelecti
             pattern = ((Text)control).getText();
         }
 
-
-
-        model = (List)CdmStore.getService(ITaxonService.class).getUuidAndTitleCache(Taxon.class, limitOfInitialElements, pattern);
+        if (pattern == null || pattern.equals("?")){
+            model = (List)CdmStore.getService(ITaxonService.class).getUuidAndTitleCache(Taxon.class, null, null);
+        }else{
+            model = (List)CdmStore.getService(ITaxonService.class).getUuidAndTitleCache(Taxon.class, limitOfInitialElements, pattern);
+        }
     }
 
     /** {@inheritDoc} */
index 5292eac19fd1be29961d8b0e555c12f3cd183a94..f727331f7b4583ac36a232f9eeb03aeaefa7c9b3 100644 (file)
@@ -149,10 +149,11 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                            selectedClassification = this.cdmBaseToBeFiltered.getClassification();
                        }
                }
-
-               //FIXME prelim
-               pattern = pattern + "*";
-               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(),  limitOfInitialElements, pattern);
+               if (pattern == null || pattern.equals("?")){
+                   model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(),  limitOfInitialElements, pattern);
+               }else{
+                   model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(),  null, null);
+               }
        }
 
        /** {@inheritDoc} */