better messaging when convert person to team does not work
authorU-BGBM\k.luther <k.luther@BGBM11732.bgbm.fu-berlin.de>
Wed, 2 Sep 2015 10:27:13 +0000 (12:27 +0200)
committerU-BGBM\k.luther <k.luther@BGBM11732.bgbm.fu-berlin.de>
Wed, 2 Sep 2015 10:27:13 +0000 (12:27 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java

index ee587aaa601eb440f9336f4fc9c8ec959bee1d50..a016571e2862abf02bffe9917525ea9a842af317 100644 (file)
@@ -46,9 +46,9 @@ public class ConvertPerson2TeamHandler extends AbstractHandler {
        @Override\r
        public Object execute(ExecutionEvent event) throws ExecutionException {\r
                ISelection selection = HandlerUtil.getCurrentSelection(event);\r
-               \r
+\r
                IEditorPart editor = HandlerUtil.getActiveEditor(event);\r
-               \r
+\r
                IEditorInput input = editor.getEditorInput();\r
                if (editor.isDirty()){\r
                        boolean proceed = MessageDialog.openQuestion(null,\r
@@ -60,17 +60,17 @@ public class ConvertPerson2TeamHandler extends AbstractHandler {
                        }\r
                }\r
                if((input instanceof IEntityPersistenceService) && (selection instanceof IStructuredSelection)){\r
-                       \r
-                       \r
+\r
+\r
                        IDocumentProvider provider = ((BulkEditor) editor).getDocumentProvider();\r
-                       LineAnnotationModel model = \r
+                       LineAnnotationModel model =\r
                                        (LineAnnotationModel) provider.getAnnotationModel(input);\r
-                       \r
-                       \r
+\r
+\r
                        IStructuredSelection structuredSelection = (IStructuredSelection) selection;\r
-                       \r
+\r
                        IEntityPersistenceService persistenceService = (IEntityPersistenceService) input;\r
-               \r
+\r
                        Team team ;\r
                        for(Object object : structuredSelection.toList()){\r
                                LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);\r
@@ -82,12 +82,12 @@ public class ConvertPerson2TeamHandler extends AbstractHandler {
                                        } catch (IllegalArgumentException e) {\r
                                                MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getLocalizedMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true);\r
                                        } catch (MergeException e) {\r
-                                               MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true);\r
+                                               MessagingUtils.informationDialog("Convert not possible", "Person can not be transformed into team as it is referenced in a way that does not allow converting");\r
                                        }\r
                                }else{\r
                                        MessagingUtils.informationDialog("Can not convert Person into a Team", "convert Person to Team can only be called on a person.");\r
                                }\r
-                               \r
+\r
                                if (team != null){\r
                                        ((BulkEditor) editor).removeAnnotatedLine(annotation);\r
                                        ((BulkEditor) editor).createAnnotatedLine(team);\r