// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/EditorConfigPlugin.java
// 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);
// 	}
// }


import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ec4e.EditorConfigPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;

/**
 *  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.internal;



/**
 * Images for .editorconfig
 *
 */
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();

// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/EditorConfigPlugin.java
// 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);
// 	}
// }


// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigImages.java
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ec4e.EditorConfigPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;

/**
 *  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.internal;



/**
 * Images for .editorconfig
 *
 */
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);
