package com.st.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 {

	// The plug-in ID
	public static final String PLUGIN_ID = "com.st.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)
	 */
	@Override
	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)
	 */
	@Override
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

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

	@Override
	protected void initializeImageRegistry(ImageRegistry reg) {
		Bundle b = FrameworkUtil.getBundle(this.getClass());
		
		reg.put(RentalUIConstants.IMG_AGENCY, ImageDescriptor.createFromURL(b.getEntry(RentalUIConstants.IMG_AGENCY)));
		reg.put(RentalUIConstants.IMG_CUSTOMERS, ImageDescriptor.createFromURL(b.getEntry(RentalUIConstants.IMG_CUSTOMERS)));
		reg.put(RentalUIConstants.IMG_RENTAL_OBJECTS, ImageDescriptor.createFromURL(b.getEntry(RentalUIConstants.IMG_RENTAL_OBJECTS)));
		reg.put(RentalUIConstants.IMG_RENTALS, ImageDescriptor.createFromURL(b.getEntry(RentalUIConstants.IMG_RENTALS)));
	}

}

@@ -20,16 +20,258 @@
 al.ui;%0A%0A
+import org.eclipse.core.runtime.IConfigurationElement;%0Aimport org.eclipse.core.runtime.IExtension;%0Aimport org.eclipse.core.runtime.IExtensionPoint;%0Aimport org.eclipse.core.runtime.IExtensionRegistry;%0Aimport org.eclipse.core.runtime.Platform;%0A
 import o
@@ -1102,16 +1102,513 @@
 = this;%0A
+%09%09%0A%09%09readViewExtensions();%0A%09%7D%0A%0A%09private void readViewExtensions() %7B%0A%09%09IExtensionRegistry registry = Platform.getExtensionRegistry();%0A%09%09%0A%09%09for (IConfigurationElement e : registry.getConfigurationElementsFor(%22org.eclipse.ui.views%22)) %7B%0A%09%09%09if (e.getName().equals(%22view%22)) %7B%0A%09%09%09%09System.out.print(%22Plugin : %22);%0A%09%09%09%09System.out.print(e.getNamespaceIdentifier());%0A%09%09%09%09System.out.print(%22%5Ct%22);%0A%09%09%09%09System.out.print(%22View : %22);%0A%09%09%09%09System.out.print(e.getAttribute(%22name%22));%0A%09%09%09%09System.out.println();%0A%09%09%09%7D%0A%09%09%7D%0A
 %09%7D%0A%0A%09/*%0A

Read and print all views extensions at Rental UI plugin startup