incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject 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
Date Fri, 29 May 2009 12:16:40 GMT
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)



Mime
View raw message