/**
 * Copyright (C) 2019 Patrik Dufresne Service Logiciel <info@patrikdufresne.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package com.planimod.ui;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.Policy;

/**
 * The policy class top be used for Planimod application specific.
 */
public class PlanimodPolicy {

    /**
     * This function should be used when an operation want to display an unexpected runtime error.
     * <p>
     * This implementation use the JFace {@link Policy} class to show the error.
     * 
     * @param e
     *            the exception.
     */
    public static void showException(Throwable e) {
        String message = e.getLocalizedMessage();
        Policy.getStatusHandler().show(new Status(IStatus.ERROR, Policy.JFACE, message, e), null);
    }

}
