OpenDefinedTermEditorHandler : changed error dialog to warning since there is no...
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 10 Sep 2014 14:37:43 +0000 (14:37 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 10 Sep 2014 14:37:43 +0000 (14:37 +0000)
CdmErrorDialog : changed copy item text to avoid confusion
MessagingUtils : cleanup and added MultiStatus errorDialog to solve windows problem (#4416)

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmErrorDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/MessagingUtils.java

index 64f8597ebf65c678ab4973cb0cd45dd33c5abd27..7fccbc5f317df532f217128f9becf6a55606d0d3 100644 (file)
@@ -20,9 +20,9 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 // $Id$\r
 /**\r
  * Copyright (C) 2009 EDIT\r
 // $Id$\r
 /**\r
  * Copyright (C) 2009 EDIT\r
- * European Distributed Institute of Taxonomy \r
+ * European Distributed Institute of Taxonomy\r
  * http://www.e-taxonomy.eu\r
  * http://www.e-taxonomy.eu\r
- * \r
+ *\r
  * The contents of this file are subject to the Mozilla Public License Version 1.1\r
  * See LICENSE.TXT at the top of this package for the full license terms.\r
  */\r
  * The contents of this file are subject to the Mozilla Public License Version 1.1\r
  * See LICENSE.TXT at the top of this package for the full license terms.\r
  */\r
@@ -45,12 +45,11 @@ public class OpenDefinedTermEditorHandler extends AbstractHandler implements IHa
                try {\r
                        activePage.openEditor(new TermEditorInput(TermType.getByUuid(UUID.fromString(termTypeUuid))), DefinedTermEditor.ID);\r
                } catch (PartInitException e) {\r
                try {\r
                        activePage.openEditor(new TermEditorInput(TermType.getByUuid(UUID.fromString(termTypeUuid))), DefinedTermEditor.ID);\r
                } catch (PartInitException e) {\r
-                       \r
+\r
                        String PID = "eu.etaxonomy.taxeditor.application";\r
                        MultiStatus info = new MultiStatus(PID, 1, "You might be missing sufficient permissions to open the Defined Term Editor", null);\r
                        info.add(new Status(IStatus.WARNING, PID, 1, e.getMessage(), null));\r
                        String PID = "eu.etaxonomy.taxeditor.application";\r
                        MultiStatus info = new MultiStatus(PID, 1, "You might be missing sufficient permissions to open the Defined Term Editor", null);\r
                        info.add(new Status(IStatus.WARNING, PID, 1, e.getMessage(), null));\r
-                       MessagingUtils.errorDialog("Cannot open Defined Term Editor", getClass(), info);\r
-                       MessagingUtils.error(getClass(), e);\r
+                       MessagingUtils.warningDialog("Cannot open Defined Term Editor", getClass(), info);\r
                }\r
 \r
                return null;\r
                }\r
 \r
                return null;\r
index eb5a8283fef8229f65f140d039323219ebd56338..792386b585b7ef11ad73b42bc7cdf0651b3dcbb3 100644 (file)
@@ -3,32 +3,35 @@ package eu.etaxonomy.taxeditor.model;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
 import org.eclipse.swt.widgets.Shell;
 
 /**
  * Error dialog class specifically implemented for the editor.
  * The main difference with {@link org.eclipse.jface.dialogs.ErrorDialog} is that
  * this dialog has a fixed max height.
 import org.eclipse.swt.widgets.Shell;
 
 /**
  * Error dialog class specifically implemented for the editor.
  * The main difference with {@link org.eclipse.jface.dialogs.ErrorDialog} is that
  * this dialog has a fixed max height.
- * 
+ *
  * @author cmathew
  *
  */
 public         class CdmErrorDialog extends ErrorDialog {
 
        private static final int DIALOG_MAX_HEIGHT = 500;
  * @author cmathew
  *
  */
 public         class CdmErrorDialog extends ErrorDialog {
 
        private static final int DIALOG_MAX_HEIGHT = 500;
-       
+
        public CdmErrorDialog(Shell parentShell, String dialogTitle,
                        String message, IStatus status) {
        public CdmErrorDialog(Shell parentShell, String dialogTitle,
                        String message, IStatus status) {
-               super(parentShell, 
-                               dialogTitle, 
-                               message, status, 
-                               IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);            
-       }               
-       
+               super(parentShell,
+                               dialogTitle,
+                               message, status,
+                               IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
+       }
+
        @Override
        @Override
-       protected void buttonPressed(int id) {                  
+       protected void buttonPressed(int id) {
                super.buttonPressed(id);
                if (id == IDialogConstants.DETAILS_ID) {
                        Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
                super.buttonPressed(id);
                if (id == IDialogConstants.DETAILS_ID) {
                        Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -39,6 +42,13 @@ public       class CdmErrorDialog extends ErrorDialog {
                                getShell().setSize(getShell().getSize().x, oldSize.y);
                        }
                }
                                getShell().setSize(getShell().getSize().x, oldSize.y);
                        }
                }
-               
-       }                                       
+
+       }
+
+       @Override
+       protected List createDropDownList(Composite parent) {
+           List list = super.createDropDownList(parent);
+           list.getMenu().getItem(0).setText(JFaceResources.getString("copy all"));
+           return list;
+       }
 }
 }
index 566fab4e923b1d36b6febebae75d4ca43d59c99e..1590474e05a2dee7315e99a1aba21c2954178ff3 100644 (file)
@@ -2,6 +2,8 @@ package eu.etaxonomy.taxeditor.model;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.log4j.Logger;
 import org.eclipse.core.runtime.IStatus;
 
 import org.apache.log4j.Logger;
 import org.eclipse.core.runtime.IStatus;
@@ -23,334 +25,339 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
  *
  */
 public class MessagingUtils {
  *
  */
 public class MessagingUtils {
-       public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
-       public final static String CONTACT_MESSAGE = System.getProperty("line.separator") +  "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
-
-       /**
-        * Gets the Log4J logger for a given class
-        *
-        * @param clazz
-        *            a {@link java.lang.Class} object.
-        * @return a {@link org.apache.log4j.Logger} object.
-        */
-       public static Logger getLog4JLogger(Class clazz) {
-               return Logger.getLogger(clazz);
-       }
-
-       /**
-        * Logs details from a given Status object
-        *
-        * @param status
-        *                              a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       private static void log(IStatus status) {
-               TaxeditorStorePlugin.getDefault().getLog().log(status);
-       }
-
-       /**
-        * Logs a status object as information.
-        *
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void info(IStatus status) {
-               log(status);
-       }
-
-       /**
-        * Logs a string as information.
-        *
-        * @param message
-        *            a {@link java.lang.String} object.
-        */
-       public static void info(String message) {
-               IStatus status = new Status(IStatus.INFO, AbstractUtility.getPluginId(), message);
-               info(status);
-       }
-
-       /**
-        * Logs an exception from a given source as a warning.
-        *
-        * @param source
-        * @param t
-        */
-       public static void warn(Class source, Throwable t) {
-               IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), t.getMessage(), t);
-               MessagingUtils.getLog4JLogger(source).warn(t);
-               log(status);
-       }
-
-       /**
-        * Logs a status object from a given source as a warning.
-        *
-        * @param source
-        * @param status
-        */
-       public static void warn(Class source, IStatus status) {
-               MessagingUtils.getLog4JLogger(source).warn(status.getMessage(), status.getException());
-               log(status);
-       }
-
-       /**
-        * Logs a string from a given source as a warning.
-        *
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        */
-       public static void warn(Class source, String message) {
-               IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), message);
-               MessagingUtils.getLog4JLogger(source).warn(message);
-               log(status);
-       }
-
-       /**
-        * Logs a status object from a given source as an error.
-        *
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void error(Class source, IStatus status) {
-               getLog4JLogger(source)
-                               .error(status.getMessage(), status.getException());
-               log(status);
-       }
-
-       /**
-        * Logs a string and exception from a given source as an error.
-        *
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        * @param t
-        *            a {@link java.lang.Throwable} object.
-        */
-       public static void error(Class source, String message, Throwable t) {
-               IStatus status = new Status(IStatus.ERROR, AbstractUtility.getPluginId(), message, t);
-               error(source, status);
-       }
-
-
-
-       /**
-        * Logs an exception from a given source as an error.
-        *
-        *
-        * @param source
-        *            a {@link java.lang.Class} object.
-        * @param t
-        *            a {@link java.lang.Throwable} object.
-        */
-       public static void error(Class source, Throwable t) {
-               error(source.getClass(), t.getMessage(), t);
-       }
-
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void errorDialog(final String title,
-                       final Object source,
-                       final String message,
-                       final IStatus status) {
-
-               Display.getDefault().asyncExec(new Runnable() {
-
-                       @Override
-                       public void run() {
-                               CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status);
-                               ced.open();
-                               Class<? extends Object> clazz = source != null ? source
-                                               .getClass() : this.getClass();
-                                               error(clazz, status);
-                       }
-               });
-       }
-
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        * @param source
-        * @param message
-        * @param pluginId
-        * @param t
-        */
-       public static void errorDialog(final String title,
-                       final Object source,
-                       final String message,
-                       final String pluginId,
-                       final Throwable t,
-                       boolean addContactMesg) {
-               // Usually the status contains only the first line of the stack trace.
-               // For the unexpected messages we need the entire stack trace so we
-               // create a new status with the entire stacktrace
-               StringWriter sw = new StringWriter();
-               t.printStackTrace(new PrintWriter(sw));
-               String finalMessage = t.getMessage();
-               if(addContactMesg) {
-                       finalMessage += MessagingUtils.CONTACT_MESSAGE;
-               }
-               IStatus status = new Status(IStatus.ERROR,
-                               pluginId,
-                               finalMessage,
-                               new Exception(sw.toString()));
-               errorDialog(title, source, message, status);
-       }
-
-
-
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void errorDialog(final String title,
-                       final Object source,
-                       final String message,
-                       final IStatus status,
-                       final boolean showStackTrace) {
-               if(showStackTrace && status.getException() != null) {
-                       errorDialog(title, source,  status.getPlugin(), message, status.getException(),true);
-               } else {
-                       errorDialog(title, source, message, status);
-               }
-       }
-
-
-       /**
-        * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void errorDialog(final String title, final Object source,
-                       final IStatus status) {
-               errorDialog(title, source, null, status);
-       }
-
-       /**
-        * Displays a dialog for an exception occurring in an operation.
-        *
-        * This will be either a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog} in case of a
-        * security runtime exception or a warning {@link org.eclipse.jface.dialogs.MessageDialog} in
-        * case of any other exception.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param source
-        *            a {@link java.lang.Object} object.
-        * @param status
-        *            a {@link org.eclipse.core.runtime.IStatus} object.
-        */
-       public static void operationDialog(final Object source,
-                       final Exception ex,
-                       final String pluginId,
-                       final String operationlabel,
-                       final String hint) {
-
-               Display.getDefault().asyncExec(new Runnable() {
-
-                       @Override
-                       public void run() {
-                               MultiStatus info = null;
-                       String title = null;
-
-                       // FIXME cannot access TaxonomicEditorPlugin.PLUGIN_ID from here
-                       // String PID = TaxonomicEditorPlugin.PLUGIN_ID;
-                       String PID = "eu.etaxonomy.taxeditor.application";
-
-                       // checking security exceptions for every operation
-                       RuntimeException securityRuntimeException = SecurityExceptionUtils.findSecurityRuntimeException(ex);
-
-                       // in case of a security exception it is a warning, else it is an error
-                       if(securityRuntimeException != null){
-                               title = "Your changes could not be saved!";
-                               warningDialog(title, source, String.format("You are missing sufficient permissions for the operation \"%s\". %s", operationlabel, hint));
-                       } else {
-                               title = "Error executing operation";
-                               errorDialog(title, source, String.format("An error occured while executing %s. %s", operationlabel, hint), pluginId, ex, true);
-
-                       }
-
-
-                       }
-               });
-       }
-
-
-
-
-       /**
-        * Displays a question {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        * @return a boolean.
-        */
-       public static boolean confirmDialog(String title, String message) {
-               return MessageDialog.openQuestion(AbstractUtility.getShell(), title, message);
-       }
-
-       /**
-        * Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        * @param source
-        * @param message
-        */
-       public static void messageDialog(final String title, final Object source, final String message) {
-               MessagingUtils.messageDialog(title, source, message, null, true);
-       }
-
-
-
-       /**
-        * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            The dialogs title
-        * @param source
-        *            The object where the warning was generated (used by log4j)
-        * @param message
-        *            An informative String to be presented to the user
-        * @param title
-        *            The dialogs title
-        * @param t
-        *            a Throwable if one exists or null
-        */
-       public static void messageDialog(final String title,
-               final Object source,
-                       final String message,
-                       final Throwable t) {
-           MessagingUtils.messageDialog(title, source, message, t, true);
-       }
-
-          /**
+    public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
+    public final static String CONTACT_MESSAGE = System.getProperty("line.separator") +  "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
+
+    /**
+     * Gets the Log4J logger for a given class
+     *
+     * @param clazz
+     *            a {@link java.lang.Class} object.
+     * @return a {@link org.apache.log4j.Logger} object.
+     */
+    public static Logger getLog4JLogger(Class clazz) {
+        return Logger.getLogger(clazz);
+    }
+
+    /**
+     * Logs details from a given Status object
+     *
+     * @param status
+     *                                 a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    private static void log(IStatus status) {
+        TaxeditorStorePlugin.getDefault().getLog().log(status);
+    }
+
+    /**
+     * Logs a status object as information.
+     *
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    public static void info(IStatus status) {
+        log(status);
+    }
+
+    /**
+     * Logs a string as information.
+     *
+     * @param message
+     *            a {@link java.lang.String} object.
+     */
+    public static void info(String message) {
+        IStatus status = new Status(IStatus.INFO, AbstractUtility.getPluginId(), message);
+        info(status);
+    }
+
+    /**
+     * Logs an exception from a given source as a warning.
+     *
+     * @param source
+     * @param t
+     */
+    public static void warn(Class source, Throwable t) {
+        IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), t.getMessage(), t);
+        MessagingUtils.getLog4JLogger(source).warn(t);
+        log(status);
+    }
+
+    /**
+     * Logs a status object from a given source as a warning.
+     *
+     * @param source
+     * @param status
+     */
+    public static void warn(Class source, IStatus status) {
+        MessagingUtils.getLog4JLogger(source).warn(status.getMessage(), status.getException());
+        log(status);
+    }
+
+    /**
+     * Logs a string from a given source as a warning.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     */
+    public static void warn(Class source, String message) {
+        IStatus status = new Status(IStatus.WARNING, AbstractUtility.getPluginId(), message);
+        MessagingUtils.getLog4JLogger(source).warn(message);
+        log(status);
+    }
+
+    /**
+     * Logs a status object from a given source as an error.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    public static void error(Class source, IStatus status) {
+        getLog4JLogger(source)
+        .error(status.getMessage(), status.getException());
+        log(status);
+    }
+
+    /**
+     * Logs a string and exception from a given source as an error.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     * @param t
+     *            a {@link java.lang.Throwable} object.
+     */
+    public static void error(Class source, String message, Throwable t) {
+        IStatus status = new Status(IStatus.ERROR, AbstractUtility.getPluginId(), message, t);
+        error(source, status);
+    }
+
+
+
+    /**
+     * Logs an exception from a given source as an error.
+     *
+     *
+     * @param source
+     *            a {@link java.lang.Class} object.
+     * @param t
+     *            a {@link java.lang.Throwable} object.
+     */
+    public static void error(Class source, Throwable t) {
+        error(source.getClass(), t.getMessage(), t);
+    }
+
+    /**
+     * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param source
+     *            a {@link java.lang.Object} object.
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    private static void errorDialog(final String title,
+            final Object source,
+            final String message,
+            final IStatus status) {
+
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status);
+                ced.open();
+                Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
+                error(clazz, status);
+            }
+        });
+    }
+
+    private static void errorDialog(final String title,
+            final Object source,
+            final Throwable t,
+            final MultiStatus status) {
+
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, t.getMessage(), status);
+                ced.open();
+                Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
+
+                // Usually the status contains only the first line of the stack trace.
+                // For the unexpected messages we need the entire stack trace so we
+                // create a new status with the entire stacktrace
+                StringWriter sw = new StringWriter();
+                t.printStackTrace(new PrintWriter(sw));
+                IStatus singleStatus = new Status(IStatus.ERROR,
+                        status.getPlugin(),
+                        status.getMessage(),
+                        new Exception(sw.toString()));
+
+                error(clazz, singleStatus);
+            }
+        });
+    }
+
+    /**
+     * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
+     *
+     * @param title
+     * @param source
+     * @param message
+     * @param pluginId
+     * @param t
+     */
+    public static void errorDialog(final String title,
+            final Object source,
+            final String message,
+            final String pluginId,
+            final Throwable t,
+            boolean addContactMesg) {
+
+
+        StringBuffer sbStackTrace = new StringBuffer();
+
+        // We need to build a MultiStatus object since the simple
+        // idea of writing out the stack trace as a single string
+        // leads to a single line on windows
+        List<Status> childStatuses = new ArrayList<Status>();
+        for (StackTraceElement ste : t.getStackTrace()) {
+            // build & add status
+            childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
+        }
+
+        // build message with contact info
+        String finalMessage = message;
+
+        if(finalMessage == null || finalMessage.isEmpty()) {
+            finalMessage = "";
+        }
+
+        if(addContactMesg) {
+            finalMessage += MessagingUtils.CONTACT_MESSAGE;
+        }
+
+        MultiStatus ms = new MultiStatus(pluginId,
+                IStatus.ERROR,
+                childStatuses.toArray(new Status[] {}),
+                finalMessage,
+                t);
+
+        errorDialog(title, source, t, ms);
+    }
+
+
+    /**
+     * Displays a dialog for an exception occurring in an operation.
+     *
+     * This will be either a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog} in case of a
+     * security runtime exception or a warning {@link org.eclipse.jface.dialogs.MessageDialog} in
+     * case of any other exception.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param source
+     *            a {@link java.lang.Object} object.
+     * @param status
+     *            a {@link org.eclipse.core.runtime.IStatus} object.
+     */
+    public static void operationDialog(final Object source,
+            final Exception ex,
+            final String pluginId,
+            final String operationlabel,
+            final String hint) {
+
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                MultiStatus info = null;
+                String title = null;
+
+                // FIXME cannot access TaxonomicEditorPlugin.PLUGIN_ID from here
+                // String PID = TaxonomicEditorPlugin.PLUGIN_ID;
+                String PID = "eu.etaxonomy.taxeditor.application";
+
+                // checking security exceptions for every operation
+                RuntimeException securityRuntimeException = SecurityExceptionUtils.findSecurityRuntimeException(ex);
+
+                // in case of a security exception it is a warning, else it is an error
+                if(securityRuntimeException != null){
+                    title = "Your changes could not be saved!";
+                    warningDialog(title, source, String.format("You are missing sufficient permissions for the operation \"%s\". %s", operationlabel, hint));
+                } else {
+                    title = "Error executing operation";
+                    errorDialog(title, source, String.format("An error occured while executing %s. %s", operationlabel, hint), pluginId, ex, true);
+
+                }
+
+
+            }
+        });
+    }
+
+
+
+
+    /**
+     * Displays a question {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     * @return a boolean.
+     */
+    public static boolean confirmDialog(String title, String message) {
+        return MessageDialog.openQuestion(AbstractUtility.getShell(), title, message);
+    }
+
+    /**
+     * Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     * @param source
+     * @param message
+     */
+    public static void messageDialog(final String title, final Object source, final String message) {
+        MessagingUtils.messageDialog(title, source, message, null, true);
+    }
+
+
+
+    /**
+     * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            The dialogs title
+     * @param source
+     *            The object where the warning was generated (used by log4j)
+     * @param message
+     *            An informative String to be presented to the user
+     * @param title
+     *            The dialogs title
+     * @param t
+     *            a Throwable if one exists or null
+     */
+    public static void messageDialog(final String title,
+            final Object source,
+            final String message,
+            final Throwable t) {
+        MessagingUtils.messageDialog(title, source, message, t, true);
+    }
+
+    /**
      * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
      *
      * @param title
      * Displays an error {@link org.eclipse.jface.dialogs.MessageDialog}.
      *
      * @param title
@@ -364,30 +371,30 @@ public class MessagingUtils {
      * @param t
      *            a Throwable if one exists or null
      */
      * @param t
      *            a Throwable if one exists or null
      */
-       public static void messageDialog(final String title,
-               final Object source,
-               final String message,
-               final Throwable t,
-               boolean async) {
-           if(async) {
-               Display.getDefault().asyncExec(new Runnable() {
-
-                   @Override
-                   public void run() {
-                       MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
-                       Class<? extends Object> clazz = source != null ? source
-                               .getClass() : this.getClass();
-                               error(clazz, message, t);
-                   }
-
-
-               });
-           } else {
-               MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
-               Class<? extends Object> clazz = source != null ? source.getClass() : TaxeditorStorePlugin.class;
-               error(clazz, message, t);
-           }
-       }
+    public static void messageDialog(final String title,
+            final Object source,
+            final String message,
+            final Throwable t,
+            boolean async) {
+        if(async) {
+            Display.getDefault().asyncExec(new Runnable() {
+
+                @Override
+                public void run() {
+                    MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
+                    Class<? extends Object> clazz = source != null ? source
+                            .getClass() : this.getClass();
+                            error(clazz, message, t);
+                }
+
+
+            });
+        } else {
+            MessageDialog.openError(AbstractUtility.getShell(), title, message + getCauseRecursively(t));
+            Class<? extends Object> clazz = source != null ? source.getClass() : TaxeditorStorePlugin.class;
+            error(clazz, message, t);
+        }
+    }
 
     public static String getCauseRecursively(Throwable t) {
         if(t == null){
 
     public static String getCauseRecursively(Throwable t) {
         if(t == null){
@@ -401,80 +408,80 @@ public class MessagingUtils {
         }
 
     }
         }
 
     }
-       /**
-        * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        * @param termBase
-        * @param status
-        */
-       public static void warningDialog(String title, Object source,
-                       IStatus status) {
-               MessagingUtils.warningDialog(title, source, status.getMessage());
-       }
-
-       /**
-        * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            The dialogs title
-        * @param source
-        *            The object where the warning was generated (used by log4j)
-        * @param message
-        *            An informative String to be presented to the user
-        */
-       public static void warningDialog(final String title, final Object source, final String message) {
-               Display.getDefault().asyncExec(new Runnable() {
-
-                       @Override
-               public void run() {
-                               MessageDialog.openWarning(AbstractUtility.getShell(), title, message);
-                               Class<? extends Object> clazz = source != null ? source
-                                               .getClass() : AbstractUtility.class;
-                               warn(clazz, message);
-                       }
-               });
-       }
-
-       /**
-        * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        * @param status
-        */
-       public static void informationDialog(final String title, final IStatus status) {
-               MessagingUtils.informationDialog(title, status.getMessage());
-       }
-
-       /**
-        * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
-        *
-        * @param title
-        *            a {@link java.lang.String} object.
-        * @param message
-        *            a {@link java.lang.String} object.
-        */
-       public static void informationDialog(final String title,
-                       final String message) {
-               Display.getDefault().asyncExec(new Runnable() {
-
-                       @Override
-               public void run() {
-                               MessageDialog.openInformation(AbstractUtility.getShell(), title, message);
-                       }
-               });
-       }
-
-       /**
-        * Open a message box that informs the user about unimplemented
-        * functionality. This method is for developer convenience.
-        *
-        * @param source
-        *            a {@link java.lang.Object} object.
-        */
-       public static void notImplementedMessage(Object source) {
-               warningDialog("Not yet implemented", source,
-                               "This functionality is not yet implemented.");
-       }
+    /**
+     * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     * @param termBase
+     * @param status
+     */
+    public static void warningDialog(String title, Object source,
+            IStatus status) {
+        MessagingUtils.warningDialog(title, source, status.getMessage());
+    }
+
+    /**
+     * Displays a warning {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            The dialogs title
+     * @param source
+     *            The object where the warning was generated (used by log4j)
+     * @param message
+     *            An informative String to be presented to the user
+     */
+    public static void warningDialog(final String title, final Object source, final String message) {
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                MessageDialog.openWarning(AbstractUtility.getShell(), title, message);
+                Class<? extends Object> clazz = source != null ? source
+                        .getClass() : AbstractUtility.class;
+                        warn(clazz, message);
+            }
+        });
+    }
+
+    /**
+     * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     * @param status
+     */
+    public static void informationDialog(final String title, final IStatus status) {
+        MessagingUtils.informationDialog(title, status.getMessage());
+    }
+
+    /**
+     * Displays an information {@link org.eclipse.jface.dialogs.MessageDialog}.
+     *
+     * @param title
+     *            a {@link java.lang.String} object.
+     * @param message
+     *            a {@link java.lang.String} object.
+     */
+    public static void informationDialog(final String title,
+            final String message) {
+        Display.getDefault().asyncExec(new Runnable() {
+
+            @Override
+            public void run() {
+                MessageDialog.openInformation(AbstractUtility.getShell(), title, message);
+            }
+        });
+    }
+
+    /**
+     * Open a message box that informs the user about unimplemented
+     * functionality. This method is for developer convenience.
+     *
+     * @param source
+     *            a {@link java.lang.Object} object.
+     */
+    public static void notImplementedMessage(Object source) {
+        warningDialog("Not yet implemented", source,
+                "This functionality is not yet implemented.");
+    }
 
 }
 
 }