Building Eclipse Plugins


Published on

Basic terminology of eclipse plugins development

Published in: Technology, Art & Photos
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Building Eclipse Plugins

  1. 1. Developing Eclipse Plugins<br />לירן זילכה<br />מנכ&quot;ל משותף<br /><br />
  2. 2. Aluna<br />Israel’s leading Java/JavaEE and SOA consulting company<br />Customers:<br />
  3. 3. Eclipse plug-in architecture<br />Some of this material was taken from a plug-in course developed by the ECESIS project. <br />
  4. 4. Eclipse plug-in architecture<br />Flexible, structured around extension points and plug-ins<br />This architecture allows for:<br />Other tools to be used within the platform<br />Other tools to be further extended<br />Integration between tools and the platform<br />No need to wait for new product releases<br />
  5. 5. Eclipse plug-in architecture<br />Tool<br />(plug-in)<br />Tool<br />(plug-in)<br />Tool<br />(plug-in)<br />Plug-in <br />Developer<br />Environment<br />(PDE)<br />Java <br />Development<br />Tooling<br />(JDT)<br />Eclipse Platform<br />Workbench<br />Help<br />JFace<br />SWT<br />…<br />Workspace<br />Team<br />Platform Runtime<br />Eclipse SDK<br />
  6. 6. Platform runtime<br />In the Eclipse, everything is plug-in except the Platform Runtime (the kernel)<br />All other subsystems build up on the Platform Runtime following the rules of plug-ins<br />The Basic platform includes:<br />Resources Management<br />Workbench<br />Team<br />Debug<br />Help<br />
  7. 7. Extension points<br />Describe additional functionality that could be integrated with the platform<br />External tools extend the platform to bring specific functionality<br />Java Development Tooling (JDT) and Plug-in Development Environment (PDE) are external tools integrated with the platform<br />
  8. 8. Extension points<br />There are two levels of extending Eclipse:<br />Extending core platform<br />Extending existing extensions<br />Extension points may have a corresponding API interface<br />Describes what should be provided in the extension<br />
  9. 9. Plug-ins<br />Define extension points<br />Each plug-in defines its own set of extension points<br />Implement specialized functionality<br />Usually key functionality that does not already exist in the platform<br />Provide their own set of APIs<br />Used for further extension of their functionalities<br />Are external, but fully integrated<br />
  10. 10. Plug-ins<br />Implement behavior defined through extension point API interface<br />Can extend named extension points from Eclipse or extension points of other plug-ins<br />Can declare an extension point and provide an extension to it<br />Are developed in Java programming language<br />
  11. 11. What&apos;s in a plug-in?<br />A JAR file<br />An archive with the plug-in code<br />plugin.xml<br />Manifest that describes plug-in<br />about.html<br />Textual description of the plug-in<br /><br />Plugin-in properties<br />
  12. 12. Describing plug-ins<br />An extension to the platform has to be registered somewhere<br />Each plug-in has a manifest file that describes:<br />Location of the plug-in code<br />Extensions added by the plug-in<br />
  13. 13. Describing plug-ins<br />The manifest file is plugin.xml. <br />There are Eclipse tools that make it easy to edit the file without using XML directly.<br />The manifest describes:<br />Name, id, and version of the plug-in<br />List of other plug-ins (and versions) required by the plug-in described<br />Extension points<br />Where the plug-in code is located<br />
  14. 14. Example manifest file<br />&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />&lt;?eclipse version=&quot;3.0&quot;?&gt;<br />&lt;plugin <br /> name=&quot;Helloworld plug-in&quot; <br /> id=&quot;com.examples.helloworld&quot; <br /> version=&quot;1.0.0“<br />provider-name=&quot;EXAMPLE&quot;<br /> class=&quot;com.example.helloworld.HelloworldPlugin&quot;&gt; &gt; <br /> &lt;requires&gt;<br /> &lt;import plugin=&quot;org.eclipse.ui&quot;/&gt;<br /> &lt;import plugin=&quot;org.eclipse.core.runtime&quot;/&gt;<br /> &lt;import plugin=&quot;org.eclipse.core.runtime.compatibility&quot;/&gt;<br /> &lt;/requires&gt; <br /> &lt;runtime&gt;<br /> &lt;library name=&quot;helloworld.jar&quot;&gt;<br /> &lt;export name=&quot;*&quot;/&gt;<br /> &lt;/library&gt; <br /> &lt;/runtime&gt; <br /> &lt;extension point=&quot;org.eclipse.ui.views&quot;&gt;<br /> &lt;category name=&quot;Hello Category&quot; id=&quot;com.example.helloworld&quot;&gt; &lt;/category&gt; <br /> &lt;view <br /> name=&quot;Hello View&quot; icon=&quot;icons/sample.gif&quot; category=&quot;com.example.helloworld&quot; class=&quot;com.example.helloworld.HelloWorldView&quot; id=&quot;com.example.helloworld.HelloWorldView&quot;&gt; <br /> &lt;/view&gt; <br /> &lt;/extension&gt;<br />&lt;/plugin&gt;<br />
  15. 15. Packaging plug-ins<br />Plug-ins are packaged as Java Archives – JAR files<br />Archives are named using naming convention:<br />&lt;id&gt;_&lt;version&gt;.jar<br />&lt;id&gt; is the identifier<br />&lt;version&gt; is the full version number from the manifest file<br />For example: org.eclipse.demo. plugin.simple_1.0.jar<br />
  16. 16. Publishing plug-ins<br />Used for preparing plug-in for deployment on a specific platform<br />Manual publishing makes use of Ant scripts<br />Ant is a open source build tool, commonly used in building processes with Java code<br />Ant scripts are Java based (platform independent) with XML configuration<br />Ant is supported in Eclipse<br />
  17. 17. Publishing plug-ins<br />Automatic publishing is available by using Eclipse wizards<br />You don&apos;t have to use Ant scripts <br />Wizards allow publishing in a single zip file. A single zip file can contain multiple plug-ins.<br />
  18. 18. Installing plug-ins<br />Plug-ins are installed under the plugins directory under the Eclipse installation directory<br />Usually c:eclipseplugins on Windows platforms<br />
  19. 19. Plug-in fragments<br />Used for extending existing plug-ins<br />Provide an additional functionality to existing plug-ins<br />Ideal for providing add-on functionality to plug-ins<br />Packaged in separate files<br />Fragment content is treated as it was original plug-in archive<br />At runtime the platform detects fragments and merges their content with the original plug-in<br />
  20. 20. Plug-in fragments<br />Described in fragment.xml files<br />Similar to plug-in manifest files<br />Plug-in archive can contain plug-ins or fragments<br />
  21. 21. Eclipse API<br />Meant to be used by plug-in developers<br />API elements are documented and completely specified<br />The API elements specify what they are supposed to do and how they are intended to be used.<br />
  22. 22. Eclipse API<br />The Eclipse platform code is separated into:<br />API packages<br />Contain API elements<br />Non-API packages<br />Contain internal platform implementation<br />
  23. 23. Using the Eclipse API<br />The API can be used by doing one of the following:<br />Instantiating platform API classes<br />Subclassing platform API classes<br />Calling public API methods<br />Most commonly used<br />Calling protected API methods<br />Possible from API subclasses<br />
  24. 24. Using the Eclipse API<br />More ways to use the API:<br />Overriding API methods<br />Allowed for some methods<br />Implementing platform API interfaces<br />Accessing Fields in API classes and interfaces<br />Mainly final, read-only fields<br />