<commit_before>package org.mwc.cmap.gt2plot;

import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;

import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.mwc.cmap.core.property_support.RightClickSupport;
import org.mwc.cmap.core.property_support.RightClickSupport.RightClickContextItemGenerator;
import org.mwc.cmap.gt2plot.data.GTLayer;
import org.osgi.framework.BundleContext;

import MWC.GUI.Editable;
import MWC.GUI.Layer;
import MWC.GUI.Layers;

/**
 * The activator class controls the plug-in life cycle
 */
public class GtActivator extends AbstractUIPlugin
{

	// The plug-in ID
	public static final String PLUGIN_ID = "org.mwc.cmap.gt2Plot"; //$NON-NLS-1$

	// The shared instance
	private static GtActivator plugin;

	Layer theLayer;

	/**
	 * The constructor
	 */
	public GtActivator()
	{
	}

	public static void initialise()
	{
		// HACK:  we need to 'pre-initialise' the tiff reader in order 
		// to load world image files
		Iterator<ImageReader> iter2 = ImageIO.getImageReadersBySuffix("tif");
		if(!iter2.hasNext())
		{
			logError(Status.ERROR, "Failed to initialise TIFF reader for Java ImageIO", null);
			System.err.println("TIFF READER NOT READY");
		}
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
	 * )
	 */
	public void start(BundleContext context) throws Exception
	{
		super.start(context);
		plugin = this;

		// Setting the system-wide default at startup time
		System.setProperty("org.geotools.referencing.forceXY", "true");

		RightClickContextItemGenerator clicker = new RightClickContextItemGenerator()
		{

			public void generate(IMenuManager parent, Layers theLayers,
					Layer[] parentLayers, Editable[] subjects)
			{
				if (theLayer == null)
					theLayer = new GTLayer();

				// see if it's already loaded
				Layer it = theLayers.findLayer(theLayer.getName());
				if (it == null)
					theLayers.addThisLayer(theLayer);

			}
		};
		RightClickSupport.addRightClickGenerator(clicker);

	}

	/**
	 * error logging utility
	 * 
	 * @param severity
	 *          the severity; one of <code>OK</code>, <code>ERROR</code>,
	 *          <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
	 * @param message
	 *          a human-readable message, localized to the current locale
	 * @param exception
	 *          a low-level exception, or <code>null</code> if not applicable
	 */
	public static void logError(int severity, String message, Throwable exception)
	{<commit_msg>ditch image generation code we had in early dev<commit_after>package org.mwc.cmap.gt2plot;

import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;

import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.mwc.cmap.core.property_support.RightClickSupport;
import org.mwc.cmap.core.property_support.RightClickSupport.RightClickContextItemGenerator;
import org.mwc.cmap.gt2plot.data.GTLayer;
import org.osgi.framework.BundleContext;

import MWC.GUI.Editable;
import MWC.GUI.Layer;
import MWC.GUI.Layers;

/**
 * The activator class controls the plug-in life cycle
 */
public class GtActivator extends AbstractUIPlugin
{

	// The plug-in ID
	public static final String PLUGIN_ID = "org.mwc.cmap.gt2Plot"; //$NON-NLS-1$

	// The shared instance
	private static GtActivator plugin;

	Layer theLayer;

	/**
	 * The constructor
	 */
	public GtActivator()
	{
	}

	public static void initialise()
	{
		// HACK:  we need to 'pre-initialise' the tiff reader in order 
		// to load world image files
		Iterator<ImageReader> iter2 = ImageIO.getImageReadersBySuffix("tif");
		if(!iter2.hasNext())
		{
			logError(Status.ERROR, "Failed to initialise TIFF reader for Java ImageIO", null);
			System.err.println("TIFF READER NOT READY");
		}
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
	 * )
	 */
	public void start(BundleContext context) throws Exception
	{
		super.start(context);
		plugin = this;

		// Setting the system-wide default at startup time
		System.setProperty("org.geotools.referencing.forceXY", "true");
	}

	/**
	 * error logging utility
	 * 
	 * @param severity
	 *          the severity; one of <code>OK</code>, <code>ERROR</code>,
	 *          <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
	 * @param message
	 *          a human-readable message, localized to the current locale
	 * @param exception
	 *          a low-level exception, or <code>null</code> if not applicable
	 */
	public static void logError(int severity, String message, Throwable exception)
	{
{'fraction_non_alphanumeric': 0.11518111518111518, 'fraction_numerical': 0.002442002442002442, 'mean_word_length': 3.8423645320197046, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2277376', 'n_tokens_mistral': 1700, 'n_tokens_neox': 1558, 'n_words': 377}