package com.sogeti.rental.ui;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;

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

	// The plug-in ID
	public static final String PLUGIN_ID = "com.sogeti.rental.ui"; //$NON-NLS-1$

	// The shared instance
	private static RentalUiActivator plugin;
	
	/**
	 * The constructor
	 */
	public RentalUiActivator() {
	}

	/*
	 * (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;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	@Override
	protected void initializeImageRegistry(ImageRegistry reg) {
		// TODO Auto-generated method stub
		super.initializeImageRegistry(reg);
		Bundle b = FrameworkUtil.getBundle(this.getClass());
		
		reg.put(IMG_CUSTOMER, ImageDescriptor.createFromURL(b.getEntry(IMG_CUSTOMER)));
		reg.put(IMG_AGENCY, ImageDescriptor.createFromURL(b.getEntry(IMG_AGENCY)));
		reg.put(IMG_OBJECT, ImageDescriptor.createFromURL(b.getEntry(IMG_OBJECT)));
		reg.put(IMG_RENTAL, ImageDescriptor.createFromURL(b.getEntry(IMG_RENTAL)));
	}
	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static RentalUiActivator getDefault() {
		return plugin;
	}

	/**
	 * 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 imageDescriptorFromPlugin(PLUGIN_ID, path);
	}
}

@@ -26,16 +26,168 @@
 .ui;%0D%0A%0D%0A
+import org.eclipse.core.runtime.IConfigurationElement;%0D%0Aimport org.eclipse.core.runtime.IExtensionRegistry;%0D%0Aimport org.eclipse.core.runtime.Platform;%0D%0A
 import o
@@ -1071,16 +1071,356 @@
  this;%0D%0A
+%09%09%0D%0A%09%09IExtensionRegistry reg = Platform.getExtensionRegistry();%0D%0A%09%09for (IConfigurationElement e : reg.getConfigurationElementsFor(%22org.eclipse.ui.views%22))%7B%0D%0A%09%09%09%0D%0A%09%09%09String txtText = %22plugin : %22 + e.getNamespaceIdentifier() + %22%5Ct vue : %22 + e.getAttribute(%22name%22);%0D%0A%09%09%09if (e.getName().equals(%22view%22) )%0D%0A%09%09%09%09System.out.println(txtText);%0D%0A%09%09%7D%0D%0A
 %09%7D%0D%0A%0D%0A%09/

read views extentions