/******************************************************************************* * Copyright (c) 2011 Red Hat, Inc. * All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ package org.eclipse.bpmn2.modeler.ui.util; import org.eclipse.bpmn2.modeler.ui.Activator; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.ui.PlatformUI; public class ErrorUtils { public static void throwCoreException(String message) throws CoreException { IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, null); Platform.getLog(Activator.getDefault().getBundle()).log(status); throw new CoreException(status); } public static void showErrorWithLogging(IStatus status){ Platform.getLog(Activator.getDefault().getBundle()).log(status); ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "An error occured", null, status); } }