Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Extension points and the registry

While the "bundle" aspects of a plug-in may be interesting to the runtime plug-in and runtime tools, it is much more common that a plug-in is concerned with what extension points have been defined by plug-ins and what extensions are contributed by plug-ins. This information is provided by the platform extension registry, IExtensionRegistry .

Why might a plug-in want to know what extensions are present? A concrete example will help show the need for this information and the protocol for getting it.

Recall the workbench Show View dialog which shows all of the available views that have been installed in the platform.

Show View dialog with Hello entry

We know that the category names and view names of all contributed views are specified in the plugin.xml file for any plug-in that contributes an extension for org.eclipse.ui.views. But how does the workbench find out this information? From the platform extension registry. The following code is a simplified snippet based on the workbench implementation of the Show View dialog:

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IExtensionPoint point = registry.getExtensionPoint("org.eclipse.ui.views");
	if (point == null) return;
	IExtension[] extensions = point.getExtensions();
	for (int i = 0; i < extensions.length; i++)
		readExtension(extensions[i]);  //get the information about each extension

We see above that the registry can be obtained from the Platform class. The protocol in IExtensionRegistry is used to find the extension point named org.eclipse.ui.views. Information in the registry about particular extension points or extensions can be found using protocol defined in IExtensionRegistry , IExtensionPoint , and IExtension . The javadoc for these classes provides detailed information about the registry protocol.

Once the extension definition of interest has been found, protocol in IConfigurationElement can be used to examine the individual attributes of an extension.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire