Merge branch 'master' of wp5.e-taxonomy.eu:/var/git/taxeditor
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / NavigationUtil.java
index 9fdb66b7acb266a0dcae034a2c7766d74e3b7150..7e48f97fcf6066329bdb081c0b236c6e0c17236f 100644 (file)
@@ -29,17 +29,18 @@ import org.eclipse.ui.handlers.IHandlerService;
 import org.eclipse.ui.navigator.CommonViewer;
 
 import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
 import eu.etaxonomy.cdm.model.description.PolytomousKey;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 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.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
 import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
 import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
 
@@ -58,19 +59,19 @@ public class NavigationUtil extends AbstractUtility{
         */
        public static void executeEditHandler(){
 
-               String commandId = "eu.etaxonomy.taxeditor.navigation.command.editSelection";
+               String commandId = "eu.etaxonomy.taxeditor.navigation.command.update.editSelection";
 
                IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
                try {
                        handlerService.executeCommand(commandId, null);
                } catch (ExecutionException e) {
-                       AbstractUtility.error(NavigationUtil.class, e);
+                       MessagingUtils.error(NavigationUtil.class, e);
                } catch (NotDefinedException e) {
-                       AbstractUtility.error(NavigationUtil.class, e);
+                       MessagingUtils.error(NavigationUtil.class, e);
                } catch (NotEnabledException e) {
-                       AbstractUtility.error(NavigationUtil.class, e);
+                       MessagingUtils.error(NavigationUtil.class, e);
                } catch (NotHandledException e) {
-                       AbstractUtility.error(NavigationUtil.class, e);
+                       MessagingUtils.error(NavigationUtil.class, e);
                }
        }
 
@@ -88,16 +89,16 @@ public class NavigationUtil extends AbstractUtility{
                                EditorUtil.openTaxonBase(entityUuid);
                        }else if(selectedObject instanceof TaxonNameBase){
                                // TODO open bulk editor
-                               warningDialog("Not implemented yet", NavigationUtil.class, "You tried to open a name. This is not handled by the software yet.");
+                               MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "You tried to open a name. This is not handled by the software yet.");
                        }else if(selectedObject instanceof PolytomousKey){
                                EditorUtil.openPolytomousKey(entityUuid);
                        }else{
-                               warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject);
+                               MessagingUtils.warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject);
                        }
                } catch (PartInitException e) {
-                       AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
+                       MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
                } catch (Exception e) {
-                       AbstractUtility.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
+                       MessagingUtils.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
                }
        }
 
@@ -108,13 +109,13 @@ public class NavigationUtil extends AbstractUtility{
                                try {
                                        EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid());
                                } catch (PartInitException e) {
-                                       AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
+                                       MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
                                }
                        }
                }else if(selectedObject instanceof ICdmBase){
                        openEditor((ICdmBase) selectedObject);
                }else{
-                       AbstractUtility.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
+                       MessagingUtils.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
                }
        }
 
@@ -127,7 +128,7 @@ public class NavigationUtil extends AbstractUtility{
                try {
                        EditorUtil.openEmpty(parentNodeUuid);
                } catch (PartInitException e) {
-                       AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
+                       MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
                }
        }
 
@@ -196,7 +197,7 @@ public class NavigationUtil extends AbstractUtility{
                                        }
                                }
                        } catch (PartInitException e) {
-                               AbstractUtility.error(NavigationUtil.class, e.getMessage(), e);
+                               MessagingUtils.error(NavigationUtil.class, e.getMessage(), e);
                                throw new RuntimeException(e);
                        }
 
@@ -248,7 +249,7 @@ public class NavigationUtil extends AbstractUtility{
                        handleOpeningOfMultipleTaxa(synonym.getAcceptedTaxa());
 
                }else{
-                       warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment.");
+                       MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment.");
                }
 
        }
@@ -258,11 +259,11 @@ public class NavigationUtil extends AbstractUtility{
                        openEditor(acceptedTaxa.iterator().next());
                }else if(acceptedTaxa.size() > 1){
                        // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
-                       warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." +
+                       MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." +
                                        " This case is not handled yet by the software.");
                }else if(acceptedTaxa.size() == 0){
                        // this is an undesired state
-                       warningDialog("Not implemented yet", NavigationUtil.class, "This taxon is not connected to a classification. Currently editing of such taxa is not supported yet.");
+                       MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "This taxon is not connected to a classification. Currently editing of such taxa is not supported yet.");
                }
        }
 
@@ -276,11 +277,11 @@ public class NavigationUtil extends AbstractUtility{
                        openEditor(taxonNodes.iterator().next());
                }else if(taxonNodes.size() > 1){
                        // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
-                       warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." +
+                       MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." +
                                        " This case is not handled yet by the software.");
                }else if(taxonNodes.size() == 0){
                        // this is an undesired state
-                       warningDialog("Incorrect state", NavigationUtil.class, "The accepted taxon is not in a taxonomic view. This should not have happened.");
+                       MessagingUtils.warningDialog("Incorrect state", NavigationUtil.class, "The accepted taxon is not in a taxonomic view. This should not have happened.");
                }
        }