From: U-BGBM\k.luther Date: Wed, 2 Sep 2015 10:27:13 +0000 (+0200) Subject: better messaging when convert person to team does not work X-Git-Tag: 3.8.0^2~35 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/36b5f7a3bf42af450f6c17caf3cdd6af6ef0e459 better messaging when convert person to team does not work --- diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java index ee587aaa6..a016571e2 100644 --- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java +++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java @@ -46,9 +46,9 @@ public class ConvertPerson2TeamHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); - + IEditorPart editor = HandlerUtil.getActiveEditor(event); - + IEditorInput input = editor.getEditorInput(); if (editor.isDirty()){ boolean proceed = MessageDialog.openQuestion(null, @@ -60,17 +60,17 @@ public class ConvertPerson2TeamHandler extends AbstractHandler { } } if((input instanceof IEntityPersistenceService) && (selection instanceof IStructuredSelection)){ - - + + IDocumentProvider provider = ((BulkEditor) editor).getDocumentProvider(); - LineAnnotationModel model = + LineAnnotationModel model = (LineAnnotationModel) provider.getAnnotationModel(input); - - + + IStructuredSelection structuredSelection = (IStructuredSelection) selection; - + IEntityPersistenceService persistenceService = (IEntityPersistenceService) input; - + Team team ; for(Object object : structuredSelection.toList()){ LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object); @@ -82,12 +82,12 @@ public class ConvertPerson2TeamHandler extends AbstractHandler { } catch (IllegalArgumentException e) { MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getLocalizedMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true); } catch (MergeException e) { - MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true); + MessagingUtils.informationDialog("Convert not possible", "Person can not be transformed into team as it is referenced in a way that does not allow converting"); } }else{ MessagingUtils.informationDialog("Can not convert Person into a Team", "convert Person to Team can only be called on a person."); } - + if (team != null){ ((BulkEditor) editor).removeAnnotatedLine(annotation); ((BulkEditor) editor).createAnnotatedLine(team);