ef473c3a4e374e0978981aca820bbd0a0f411390
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / model / DeleteResultMessagingUtils.java
1 // $Id$
2 /**
3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.model;
11
12 import java.util.ArrayList;
13 import java.util.List;
14
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.core.runtime.Status;
17
18 import eu.etaxonomy.cdm.api.service.DeleteResult;
19
20 /**
21 * @author k.luther
22 * @date Oct 5, 2015
23 *
24 */
25 public class DeleteResultMessagingUtils extends MessagingUtils {
26 /**
27 * Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
28 *
29 * @param title
30 * @param source
31 * @param message
32 */
33 public static void messageDialogWithDetails(DeleteResult result, String message, String pluginId) {
34 if (result.isOk() && result.getExceptions().isEmpty()){
35 return;
36 }
37 List<String> details = new ArrayList<String>();
38 String title= "";
39
40 if (result.isOk() && result.getExceptions().size() > 0){
41 for (Exception e:result.getExceptions()){
42 details.add(e.getMessage());
43 }
44 title = "The delete was successfull.";
45 }
46 String stackTraceWithContext = getContextInfo(details);
47 CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, new Status(IStatus.ERROR, pluginId, null), stackTraceWithContext);
48 ced.open();
49
50
51
52 }
53 }