Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse plugin: differences between dependencies and extensions

Can someone please explain me the difference(s) between a dependence and an extension in creating an Eclipse plugin?

Thanks Simone

like image 359
Simone Di Cola Avatar asked Aug 24 '26 15:08

Simone Di Cola


1 Answers

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.

like image 82
greg-449 Avatar answered Aug 26 '26 23:08

greg-449



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!