// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigImages.java
// public class EditorConfigImages {
// 
// 	private static final String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
// 	private static final String OBJECT = ICONS_PATH + "obj16/"; // basic colors - size 16x16 //$NON-NLS-1$
// 	
// 	public static final String IMG_PROPERTY = "IMG_PROPERTY"; //$NON-NLS-1$
// 	public static final String IMG_VALUE = "IMG_VALUE"; //$NON-NLS-1$
// 	
// 	private EditorConfigImages() {
// 	}
// 
// 	private static ImageRegistry imageRegistry;
// 
// 	public static void initalize(ImageRegistry registry) {
// 		imageRegistry = registry;
// 
// 		declareRegistryImage(IMG_PROPERTY, OBJECT + "property.png"); //$NON-NLS-1$
// 		declareRegistryImage(IMG_VALUE, OBJECT + "value.png"); //$NON-NLS-1$
// 	}
// 
// 	private final static void declareRegistryImage(String key, String path) {
// 		ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
// 		Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
// 		URL url = null;
// 		if (bundle != null) {
// 			url = FileLocator.find(bundle, new Path(path), null);
// 			if (url != null) {
// 				desc = ImageDescriptor.createFromURL(url);
// 			}
// 		}
// 		imageRegistry.put(key, desc);
// 	}
// 
// 	/**
// 	 * Returns the <code>Image</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static Image getImage(String key) {
// 		return getImageRegistry().get(key);
// 	}
// 
// 	/**
// 	 * Returns the <code>ImageDescriptor</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static ImageDescriptor getImageDescriptor(String key) {
// 		return getImageRegistry().getDescriptor(key);
// 	}
// 
// 	public static ImageRegistry getImageRegistry() {
// 		if (imageRegistry == null) {
// 			imageRegistry = EditorConfigPlugin.getDefault().getImageRegistry();
// 		}
// 		return imageRegistry;
// 	}
// 
// }


import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ec4e.internal.EditorConfigImages;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

/**
 *  Copyright (c) 2017 Angelo ZERR.
 *  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:
 *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 */
package org.eclipse.ec4e;


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

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

	// The shared instance
	private static EditorConfigPlugin plugin;

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

	@Override
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
		IDEEditorConfigManager.getInstance().init();
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		IDEEditorConfigManager.getInstance().dispose();
		plugin = null;
		super.stop(context);
	}

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

	/**
	 * Utility method to log errors.
	 *
	 * @param thr
	 *            The exception through which we noticed the error
	 */
	public static void logError(final Throwable thr) {
		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, thr.getMessage(), thr));
	}

	/**
	 * Utility method to log errors.
	 *
	 * @param message
	 *            User comprehensible message
	 * @param thr
	 *            The exception through which we noticed the error
	 */
	public static void logError(final String message, final Throwable thr) {
		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr));
	}

	@Override
	protected void initializeImageRegistry(ImageRegistry registry) {

// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigImages.java
// public class EditorConfigImages {
// 
// 	private static final String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
// 	private static final String OBJECT = ICONS_PATH + "obj16/"; // basic colors - size 16x16 //$NON-NLS-1$
// 	
// 	public static final String IMG_PROPERTY = "IMG_PROPERTY"; //$NON-NLS-1$
// 	public static final String IMG_VALUE = "IMG_VALUE"; //$NON-NLS-1$
// 	
// 	private EditorConfigImages() {
// 	}
// 
// 	private static ImageRegistry imageRegistry;
// 
// 	public static void initalize(ImageRegistry registry) {
// 		imageRegistry = registry;
// 
// 		declareRegistryImage(IMG_PROPERTY, OBJECT + "property.png"); //$NON-NLS-1$
// 		declareRegistryImage(IMG_VALUE, OBJECT + "value.png"); //$NON-NLS-1$
// 	}
// 
// 	private final static void declareRegistryImage(String key, String path) {
// 		ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
// 		Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
// 		URL url = null;
// 		if (bundle != null) {
// 			url = FileLocator.find(bundle, new Path(path), null);
// 			if (url != null) {
// 				desc = ImageDescriptor.createFromURL(url);
// 			}
// 		}
// 		imageRegistry.put(key, desc);
// 	}
// 
// 	/**
// 	 * Returns the <code>Image</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static Image getImage(String key) {
// 		return getImageRegistry().get(key);
// 	}
// 
// 	/**
// 	 * Returns the <code>ImageDescriptor</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static ImageDescriptor getImageDescriptor(String key) {
// 		return getImageRegistry().getDescriptor(key);
// 	}
// 
// 	public static ImageRegistry getImageRegistry() {
// 		if (imageRegistry == null) {
// 			imageRegistry = EditorConfigPlugin.getDefault().getImageRegistry();
// 		}
// 		return imageRegistry;
// 	}
// 
// }


// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/EditorConfigPlugin.java
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ec4e.internal.EditorConfigImages;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

/**
 *  Copyright (c) 2017 Angelo ZERR.
 *  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:
 *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
 */
package org.eclipse.ec4e;


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

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

	// The shared instance
	private static EditorConfigPlugin plugin;

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

	@Override
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
		IDEEditorConfigManager.getInstance().init();
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		IDEEditorConfigManager.getInstance().dispose();
		plugin = null;
		super.stop(context);
	}

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

	/**
	 * Utility method to log errors.
	 *
	 * @param thr
	 *            The exception through which we noticed the error
	 */
	public static void logError(final Throwable thr) {
		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, thr.getMessage(), thr));
	}

	/**
	 * Utility method to log errors.
	 *
	 * @param message
	 *            User comprehensible message
	 * @param thr
	 *            The exception through which we noticed the error
	 */
	public static void logError(final String message, final Throwable thr) {
		getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr));
	}

	@Override
	protected void initializeImageRegistry(ImageRegistry registry) {

		EditorConfigImages.initalize(registry);
