You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kato-commits@incubator.apache.org by sp...@apache.org on 2009/05/29 12:16:40 UTC

svn commit: r779940 - /incubator/kato/branches/experimental/maven_restructure/org.apache.kato/plugins/kato.api.registry.plugin/src/main/java/org/apache/kato/api/plugin/Activator.java

Author: spoole
Date: Fri May 29 12:16:40 2009
New Revision: 779940

URL: http://svn.apache.org/viewvc?rev=779940&view=rev
Log:
runtime config chane to api registy project so it works out of eclipse

Modified:
    incubator/kato/branches/experimental/maven_restructure/org.apache.kato/plugins/kato.api.registry.plugin/src/main/java/org/apache/kato/api/plugin/Activator.java

Modified: incubator/kato/branches/experimental/maven_restructure/org.apache.kato/plugins/kato.api.registry.plugin/src/main/java/org/apache/kato/api/plugin/Activator.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/maven_restructure/org.apache.kato/plugins/kato.api.registry.plugin/src/main/java/org/apache/kato/api/plugin/Activator.java?rev=779940&r1=779939&r2=779940&view=diff
==============================================================================
--- incubator/kato/branches/experimental/maven_restructure/org.apache.kato/plugins/kato.api.registry.plugin/src/main/java/org/apache/kato/api/plugin/Activator.java (original)
+++ incubator/kato/branches/experimental/maven_restructure/org.apache.kato/plugins/kato.api.registry.plugin/src/main/java/org/apache/kato/api/plugin/Activator.java Fri May 29 12:16:40 2009
@@ -6,6 +6,13 @@
 import org.apache.kato.FactoryRegistry;
 import org.apache.kato.image.Image;
 import org.apache.kato.image.ImageFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
@@ -38,6 +45,8 @@
 		super.start(context);
 		plugin = this;
 		registry=FactoryRegistry.getDefaultRegistry();
+		addEclipseRegisteredFactories(registry);
+		
 		/**
 		registry.addFactory(new org.apache.kato.jvmti.process.ImageFactoryImpl());
 		registry.addFactory(new org.apache.kato.hprof.image.ImageFactoryImpl());
@@ -46,6 +55,28 @@
 		**/
 	}
 
+	private void addEclipseRegisteredFactories(FactoryRegistry registry2) throws CoreException {
+
+		IExtensionRegistry reg = Platform.getExtensionRegistry();
+		IExtensionPoint point = reg.getExtensionPoint("org.apache.kato.api","imagefactory");
+		if (point == null) {
+			for(IExtensionPoint x :reg.getExtensionPoints()) {
+				System.out.println(x.getNamespaceIdentifier());
+			}
+			return;
+		}
+		
+		for (IExtension ex : point.getExtensions()) {
+		    for (IConfigurationElement el: ex.getConfigurationElements()) {
+		     if (el.getName().equals("factory")) {
+		      ImageFactory fact = (ImageFactory)el.createExecutableExtension("action");
+		      registry.addFactory(fact);
+		    }
+		   }   
+		  }       
+		
+	}
+
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)