package org.mwc.cmap.core;

import org.eclipse.ui.plugin.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.osgi.framework.BundleContext;
import java.util.*;

/**
 * The main plugin class to be used in the desktop.
 */
public class CorePlugin extends AbstractUIPlugin {
	//The shared instance.
	private static CorePlugin plugin;
	//Resource bundle.
	private ResourceBundle resourceBundle;
	
	/**
	 * The constructor.
	 */
	public CorePlugin() {
		super();
		plugin = this;
	}

	/**
	 * This method is called upon plug-in activation
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
	}

	/**
	 * This method is called when the plug-in is stopped
	 */
	public void stop(BundleContext context) throws Exception {
		super.stop(context);
		plugin = null;
		resourceBundle = null;
	}

	/**
	 * Returns the shared instance.
	 */
	public static CorePlugin getDefault() {
		return plugin;
	}

	/**
	 * Returns the string from the plugin's resource bundle,
	 * or 'key' if not found.
	 */
	public static String getResourceString(String key) {
		ResourceBundle bundle = CorePlugin.getDefault().getResourceBundle();
		try {
			return (bundle != null) ? bundle.getString(key) : key;
		} catch (MissingResourceException e) {
			return key;
		}
	}

	/**
	 * Returns the plugin's resource bundle,
	 */
	public ResourceBundle getResourceBundle() {
		try {
			if (resourceBundle == null)
				resourceBundle = ResourceBundle.getBundle("org.mwc.cmap.core.CorePluginResources");
		} catch (MissingResourceException x) {
			resourceBundle = null;
		}
		return resourceBundle;
	}

	/**
	 * Returns an image descriptor for the image file at the given
	 * plug-in relative path.
	 *
	 * @param path the path
	 * @return the image descriptor
	 */
	public static ImageDescriptor getImageDescriptor(String path) {
		return AbstractUIPlugin.imageDescriptorFromPlugin("org.mwc.cmap.core", path);
	}
}

@@ -53,16 +53,56 @@
 ugin.*;%0A
+import org.eclipse.core.runtime.Status;%0A
 import o
@@ -1956,10 +1956,583 @@
 th);%0A%09%7D%0A
+%09%0A%09/** error logging utility%0A%09 * %0A%09 * @param severity the severity; one of %3Ccode%3EOK%3C/code%3E, %3Ccode%3EERROR%3C/code%3E, %0A%09 * %3Ccode%3EINFO%3C/code%3E, %3Ccode%3EWARNING%3C/code%3E,  or %3Ccode%3ECANCEL%3C/code%3E%0A%09 * @param message a human-readable message, localized to the%0A%09 *    current locale%0A%09 * @param exception a low-level exception, or %3Ccode%3Enull%3C/code%3E if not%0A%09 *    applicable %0A%09 */%0A%09public static void logError(int severity, String message, Throwable exception)%0A%09%7B%0A%09%09Status stat = new Status(severity,%22org.mwc.cmap.core%22, Status.OK, message, exception);%0A%09%09getDefault().getLog().log(stat);%0A%09%7D%09%0A
 %7D%0A

Add logging support