Reputation: 351
Can someone please explain me the difference(s) between a dependence and an extension in creating an Eclipse plugin?
Thanks Simone
Upvotes: 3
Views: 684
Reputation: 111216
Dependencies are the list of other plug-ins that your plug-in depends on (uses codes from). They are listed in the plug-in MANIFEST.MF
in Require-Bundle
(or sometimes Import-Package
. This is used by Eclipse to create a classpath for the plug-in (each plug-in has its own separate classpath). An example:
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.swt;bundle-version="3.102.0",
org.eclipse.e4.ui.css.core;bundle-version="0.10.100",
org.eclipse.e4.ui.css.swt;bundle-version="0.11.0"
which specifies that the plug-in depends on four of the standard Eclipse plug-ins.
Extensions are a way of letting your plug-in use functionality provided by other plug-in by XML specifications in the plugin.xml
file. So for example:
<extension
point="org.eclipse.ui.editors">
<editor
name="Ant Editor"
icon="$nl$/icons/full/obj16/ant_buildfile.gif"
class="org.eclipse.ant.internal.ui.editor.AntEditor"
contributorClass="org.eclipse.ant.internal.ui.editor.AntEditorActionContributor"
id="org.eclipse.ant.ui.internal.editor.AntEditor">
<contentTypeBinding
contentTypeId="org.eclipse.ant.core.antBuildFile"/>
</editor>
(taken from the Ant plugin). This uses the org.eclipse.ui.editors
extension point to define a new editor for the ant file type.
You can also write your own extensions which other plug-ins can then use.
Upvotes: 3