package org.mwc.cmap.narrative;

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 NarrativePlugin extends AbstractUIPlugin {
	//The shared instance.
	private static NarrativePlugin plugin;
	//Resource bundle.
	private ResourceBundle resourceBundle;
	
	/**
	 * The constructor.
	 */
	public NarrativePlugin() {
		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 NarrativePlugin 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 = NarrativePlugin.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.narrative.NarrativePluginResources");
		} 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.narrative", path);
	}
}

@@ -58,16 +58,56 @@
 ugin.*;%0A
+import org.eclipse.core.runtime.Status;%0A
 import o
@@ -2001,10 +2001,637 @@
 th);%0A%09%7D%0A
+%09%0A%09/**%0A%09 * error logging utility%0A%09 * %0A%09 * @param severity%0A%09 *          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%0A%09 *          %3Ccode%3ECANCEL%3C/code%3E%0A%09 * @param message%0A%09 *          a human-readable message, localized to the current locale%0A%09 * @param exception%0A%09 *          a low-level exception, or %3Ccode%3Enull%3C/code%3E if not 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.narrative%22, Status.OK, message, exception);%0A%09%09getDefault().getLog().log(stat);%0A%09%7D%09%0A
 %7D%0A

Add logging support