/*******************************************************************************
 * Copyright (c) 2016 Bruno Medeiros and others.
 * All rights reserved. This program and the accompanying materials
 * are 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:
 *     Bruno Medeiros - initial API and implementation
 *******************************************************************************/
package melnorme.lang.ide.core;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

import melnorme.lang.ide.core.utils.EclipseUtils;
import melnorme.utilbox.core.CommonException;

public class EclipseCore extends EclipseUtils {
	
	/** Creates an OK status with given message. */
	public static Status createOkStatus(String message) {
		return createStatus(IStatus.OK, message, null);
	}
	
	/** Creates an Info status with given message. */
	public static Status createInfoStatus(String message) {
		return createStatus(IStatus.INFO, message, null);
	}
	
	/** Creates a status describing an error in this plugin, with given message. */
	public static Status createErrorStatus(String message) {
		return createErrorStatus(message, null);
	}
	
	/** Creates a status describing an error in this plugin, with given message and given throwable. */
	public static Status createErrorStatus(String message, Throwable throwable) {
		return createStatus(IStatus.ERROR, message, throwable);
	}
	
	/** Creates a Status with given status code and message. */
	public static Status createStatus(int severity, String message, Throwable throwable) {
		return createStatus(severity, message, throwable);
	}
	
	/** Creates a CoreException describing an error in this plugin. */
	public static CoreException createCoreException(String message, Throwable throwable) {
		return new CoreException(createErrorStatus(message, throwable));
	}
	
	/** Creates a CoreException describing an error in this plugin, from given {@link CommonException} */
	public static CoreException createCoreException(CommonException ce) {
		return createCoreException(ce.getMessage(), ce.getCause());
	}
	
	/* -----------------  ----------------- */
	
	/** Logs status of given CoreException. */
	public static void logStatus(CoreException ce) {
		LangCorePlugin.getInstance().getLog().log(ce.getStatus());
	}
	
}
@@ -852,24 +852,434 @@
 Utils %7B%0D%0A%09%0D%0A
+%09private static LangCorePlugin getPluginInstance() %7B%0D%0A%09%09return LangCorePlugin.getInstance();%0D%0A%09%7D%0D%0A%09%0D%0A%09/** Creates a Status with given status code and message. */%0D%0A%09public static Status createStatus(int severity, String message, Throwable throwable) %7B%0D%0A%09%09return new Status(severity, getPluginInstance().getBundle().getSymbolicName(), message, throwable);%0D%0A%09%7D%0D%0A%09%0D%0A%09/* -----------------  ----------------- */%0D%0A%09%0D%0A
 %09/** Creates
@@ -1308,32 +1308,32 @@
 en message. */%0D%0A
-
 %09public static S
@@ -2044,220 +2044,8 @@
 %0A%09%0D%0A
-%09/** Creates a Status with given status code and message. */%0D%0A%09public static Status createStatus(int severity, String message, Throwable throwable) %7B%0D%0A%09%09return createStatus(severity, message, throwable);%0D%0A%09%7D%0D%0A%09%0D%0A
 %09/**
@@ -2665,34 +2665,25 @@
 e) %7B%0D%0A%09%09
-LangCore
+get
 Plugin
-.get
 Instance

fix regression