All pastes #337041 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-02 13:41 UTC
rendered paste body
package baseplugin;

import inner.*;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IPlatformRunnable;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;

public class PlatformRunnable4 implements IPlatformRunnable {

	public Object run(Object args) throws Exception {
		System.out.println("Jai Sri Rama");
		PlatformRunnable1 plugin;
	//	plugin.run(args);
		
		
		 IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
				 "inner", // name of plugin that exposes this extension point
				 "Innerext"); //$NON-NLS-1$ - extension id

//				  Iterate over all declared extensions of this extension point.
//				  A single plugin may extend the extension point more than once, although it's not recommended.
				 for (IExtension extension : extensionPoint.getExtensions())
				 {
//				  Iterate over the children of the extension to find one named "factories".
				 for(IConfigurationElement factories : extension.getConfigurationElements())
				 {
				 if (!"application".equals(factories.getName())) { //$NON-NLS-1$ - name of configElement
				 continue;
				 }

//				  Iterate over the children of the "factories" element to find all the ones named "factory".
				 for (IConfigurationElement factory : factories.getChildren()) {
				 if (!"run".equals(factory.getName())) { //$NON-NLS-1$
				 continue;
				 }       
				 try {
				 Object execExt = factory.createExecutableExtension("class"); //$NON-NLS-1$ - attribute name
				 if (execExt instanceof PlatformRunnable1){
//////				  HERE'S YOUR PAYLOAD: 
					 plugin = (PlatformRunnable1)execExt;
					 plugin.run(null);
				 }    
				 } catch(CoreException e) {
//				 AptPlugin.log(e, "Unable to load annotation factory from plug-in"); //$NON-NLS-1$
				 }
				 }
				 }
				 }

		
			 
				 
		return null;
	}

}