Skip to main content



      Home
Home » Eclipse Projects » Equinox » simple tutorial on OSGi/Equinox extension points?
simple tutorial on OSGi/Equinox extension points? [message #85928] Tue, 03 April 2007 08:42 Go to next message
Eclipse UserFriend
Hello!
I have searched but I am not finding example code showing how my extension point can find extensions which implement it.

How to read parameters from those extensions' plugin.xml?

How to instantiate classes specified by those extensions?
Thanks!
David
Re: simple tutorial on OSGi/Equinox extension points? [message #85943 is a reply to message #85928] Tue, 03 April 2007 09:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

http://wiki.eclipse.org/index.php/FAQ_How_do_I_declare_my_ow n_extension_point%3F

Actually, it's a missing topic area. I'll probably put something together for EZ in the near future.

Alex.
Re: simple tutorial on OSGi/Equinox extension points? [message #85960 is a reply to message #85943] Tue, 03 April 2007 10:23 Go to previous messageGo to next message
Eclipse UserFriend
> I'll probably put something together for EZ in the near future

Thanks!
What I am missing is: What Java code do I have to write to find out all extensions implementing my extension point? How do I loop through each extension;
How do I get its properties (in plugin.xml);
How do instantiate extension classes implementing my extension point interface?
Re: simple tutorial on OSGi/Equinox extension points? [message #85975 is a reply to message #85960] Tue, 03 April 2007 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

Yeah, those were pretty much the questions you asked first time around :-)

This piece of code shows how the Team providers are set up from their code:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.team.co re/src/org/eclipse/team/core/Team.java?view=markup

	private static void initializePluginIgnores(SortedMap pIgnore, SortedMap gIgnore) {
		TeamPlugin plugin = TeamPlugin.getPlugin();
		if (plugin != null) {
			IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, TeamPlugin.IGNORE_EXTENSION);
			if (extension != null) {
				IExtension[] extensions =  extension.getExtensions();
				for (int i = 0; i < extensions.length; i++) {
					IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
					for (int j = 0; j < configElements.length; j++) {
						String pattern = configElements[j].getAttribute("pattern"); //$NON-NLS-1$
						if (pattern != null) {
							String selected = configElements[j].getAttribute("enabled"); //$NON-NLS-1$
							if (selected == null) {
								// Check for selected because this used to be the field name
								selected = configElements[j].getAttribute("selected"); //$NON-NLS-1$
							}
							boolean enabled = selected != null && selected.equalsIgnoreCase("true"); //$NON-NLS-1$
							// if this ignore does already exist 
							if (gIgnore.containsKey(pattern)){
								// ignore plugins settings
								pIgnore.put(pattern, gIgnore.get(pattern));
							} else { 
								// add ignores
								pIgnore.put(pattern, Boolean.valueOf(enabled));
								gIgnore.put(pattern, Boolean.valueOf(enabled));
							}
						}
					}
				}
			}		
		}
	}


Alex.
Re: simple tutorial on OSGi/Equinox extension points? [message #86128 is a reply to message #85975] Wed, 04 April 2007 13:17 Go to previous messageGo to next message
Eclipse UserFriend
This code is helpful but I cannot find class org.eclipse.core.runtime.IExtensionRegistry in my classpath or in any of the Eclipse jars.

It is not present in org.eclipse.core.runtime_3.2.0.v20060603.jar
or in
runtime_registry_compatibility.jar

Can you tell me where I can find this class?
Thanks,
David
Re: simple tutorial on OSGi/Equinox extension points? [message #86157 is a reply to message #86128] Wed, 04 April 2007 13:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

I'd look in org.eclipse.equinox.common to see if it's there.

Alex.
Re: simple tutorial on OSGi/Equinox extension points? [message #86171 is a reply to message #86157] Wed, 04 April 2007 13:45 Go to previous message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

Sorry, I meant

org.eclipse.equinox.registry

Alex.
Previous Topic:Bundle-BuddyPolicy vs. Eclipse-BuddyPolicy
Next Topic:BUG#121737 and Eclipse 3.2.1
Goto Forum:
  


Current Time: Thu Jul 17 20:18:52 EDT 2025

Powered by FUDForum. Page generated in 0.08891 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top