| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| "http://www.w3.org/TR/html4/loose.dtd"> |
| <html lang="en"> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2009. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <title>Extensions and Extension Points</title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"> </script> |
| </head> |
| |
| <body> |
| <h1>Extensions and Extension Points</h1> |
| |
| <p>A basic rule for building modular software systems is to avoid tight |
| coupling between components. If components are tightly integrated, |
| it becomes difficult to assemble the pieces into |
| different configurations or to replace a component with a different implementation |
| without causing a ripple of changes across the system.</p> |
| |
| <p>Loose coupling in Eclipse is achieved partially through the mechanism |
| of <strong>extensions</strong> and <strong>extension points</strong>. |
| The simplest metaphor for describing extensions and extension points is electrical |
| outlets. The outlet, or socket, |
| is the extension point; the plug, or light bulb that connects to it, the |
| extension. As with electric outlets, extension points come in a wide |
| variety of shapes and sizes, and only the extensions that are designed |
| for that particular extension point will fit.</p> |
| |
| <p>When a plug-in wants to allow other plug-ins to extend or customize |
| portions of its functionality, it will declare an extension |
| point. The extension point declares a contract, typically a combination |
| of XML markup and Java interfaces, that extensions must conform to. |
| Plug-ins that want to connect to that extension point must implement |
| that contract in their extension. The key attribute is that the plug-in |
| being extended knows nothing about the plug-in that is connecting to |
| it beyond the scope of that extension point contract. This allows plug-ins |
| built by different individuals or companies to interact seamlessly, even |
| without their knowing much about one another.</p> |
| |
| <p>The Eclipse Platform has many applications of the extension |
| and extension point concept. Some extensions are entirely |
| <i>declarative</i>; that is, they contribute no code at all. For example, |
| one extension point provides customized key bindings, |
| and another defines custom file annotations, called <i>markers</i>; |
| neither of these extension points requires any code on behalf of the extension. |
| </p> |
| |
| <p>Another category of extension points is for overriding the default behavior of |
| a component. For example, the Java development tools include a |
| code formatter but also supply an extension point for third-party |
| code formatters to be plugged in. The resources plug-in has an |
| extension point that allows certain plug-ins to replace the implementation |
| of basic file operations, such as moving and deletion. </p> |
| |
| <p>Yet another category |
| of extension points is used to group related elements in the user |
| interface. For example, extension points for providing views, |
| editors, and wizards to the UI allow the base UI plug-in to group |
| common features, such as |
| putting all import wizards into a single dialog, |
| and to define a consistent way of presenting UI contributions from a wide |
| variety of other plug-ins.</p> |
| |
| <h3 class="related">Related references</h3> |
| <a href="../guide/tools/editors/manifest_editor/extensions.htm">Extensions (Plug-in Editor)</a><br> |
| <a href="../guide/tools/editors/manifest_editor/extension_points.htm">Extension Points (Plug-in Editor)</a> |
| |
| <h3 class="related">Related concepts</h3> |
| <a href="plugin.htm">Plug-in</a> |
| |
| </body> |
| </html> |