Difference between revisions of "FAQ What are extensions and extension points?"

From Eclipsepedia

Jump to: navigation, search
 
m
 
Line 4: Line 4:
 
different configurations or to replace a component with a different implementation
 
different configurations or to replace a component with a different implementation
 
without causing a ripple of changes across the system.
 
without causing a ripple of changes across the system.
 
 
  
 
Loose coupling in Eclipse is achieved partially through the mechanism  
 
Loose coupling in Eclipse is achieved partially through the mechanism  
Line 14: Line 12:
 
variety of shapes and sizes, and only the extensions that are designed
 
variety of shapes and sizes, and only the extensions that are designed
 
for that particular extension point will fit.
 
for that particular extension point will fit.
 
 
 
  
 
When a plug-in wants to allow other plug-ins to extend or customize
 
When a plug-in wants to allow other plug-ins to extend or customize
Line 28: Line 23:
 
built by different individuals or companies to interact seamlessly, even
 
built by different individuals or companies to interact seamlessly, even
 
without their knowing much about one another.
 
without their knowing much about one another.
 
 
 
  
 
The Eclipse Platform has many applications of the extension  
 
The Eclipse Platform has many applications of the extension  
Line 38: Line 30:
 
and another defines custom file annotations, called <i>markers</i>;
 
and another defines custom file annotations, called <i>markers</i>;
 
neither of these extension points requires any code on behalf of the extension.  
 
neither of these extension points requires any code on behalf of the extension.  
 
 
  
 
Another category of extension points is for overriding the default behavior of  
 
Another category of extension points is for overriding the default behavior of  
Line 47: Line 37:
 
extension point that allows certain plug-ins to replace the implementation
 
extension point that allows certain plug-ins to replace the implementation
 
of basic file operations, such as moving and deletion.  
 
of basic file operations, such as moving and deletion.  
 
 
  
 
Yet another category
 
Yet another category
Line 58: Line 46:
 
and to define a consistent way of presenting UI contributions from a wide  
 
and to define a consistent way of presenting UI contributions from a wide  
 
variety of other plug-ins.
 
variety of other plug-ins.
 
 
 
 
 
  
 
== See Also: ==
 
== See Also: ==
 +
*[[FAQ How do I declare my own extension point?]]
 +
*[[FAQ What is a plug-in?]]
 +
*[[FAQ What is the plug-in manifest file (plugin.xml)?]]
 +
*[[FAQ How do I make my plug-in connect to other plug-ins?]]
 +
*[[FAQ What is an extension point schema?]]
 +
*<i>Platform Plug-in Developer Guide</i> under Programmer&#146;s Guide, Platform architecture
  
 
+
{{Template:FAQ_Tagline}}
[[FAQ_How_do_I_declare_my_own_extension_point%3F]]
+
 
+
 
+
[[FAQ_What_is_a_plug-in%3F]]
+
 
+
 
+
[[FAQ_What_is_the_plug-in_manifest_file_%28%3Ctt%3Eplugin.xml%3C%2Ftt%3E%29%3F]]
+
 
+
 
+
[[FAQ_How_do_I_make_my_plug-in_connect_to_other_plug-ins%3F]]
+
 
+
 
+
[[FAQ_What_is_an_extension_point_schema%3F]]
+
 
+
 
+
<i>Platform Plug-in Developer Guide</i> under Programmer&#146;s Guide, Platform architecture
+
 
+
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+

Latest revision as of 20:14, 15 June 2006

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.

Loose coupling in Eclipse is achieved partially through the mechanism of extensions and extension points. 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.

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.

The Eclipse Platform has many applications of the extension and extension point concept. Some extensions are entirely declarative; that is, they contribute no code at all. For example, one extension point provides customized key bindings, and another defines custom file annotations, called markers; neither of these extension points requires any code on behalf of the extension.

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.

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.

[edit] See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.