Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "FAQ What is the plug-in manifest file (plugin.xml)?"
m |
|||
Line 1: | Line 1: | ||
− | The plug-in manifest file, <tt>plugin.xml</tt>, describes | + | The plug-in manifest file, <tt>plugin.xml</tt>, describes how the plug-in extends the platform, what extensions it publishes itself, and how it implements its functionality. The manifest file is written in XML and is parsed by the platform when the plug-in is loaded into the platform. All the information needed to display the plug-in in the UI, such as icons, menu items, and so on, is contained in the manifest file. The implementation code, found in a separate Java JAR file, is loaded when, and only when, the plug-in has to be run. This concept is referred to as <i>lazy loading</i>. Here is the manifest file for a simple plug-in: |
− | how the plug-in extends the platform, what extensions it publishes itself, | + | |
− | and how it implements its functionality. The manifest file is written in | + | |
− | XML and is parsed by the platform when the plug-in is loaded into the | + | |
− | platform. All the information needed to display the plug-in in the UI, | + | |
− | such as icons, menu items, and so on, is contained in the manifest file. The | + | |
− | implementation code, found in a separate Java JAR file, is | + | |
− | loaded when, and only when, the plug-in has to be run. This concept | + | |
− | is referred to as <i>lazy loading</i>. | + | |
− | Here is the manifest file for a simple plug-in: | + | |
<pre> | <pre> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.0"?> | <?eclipse version="3.0"?> | ||
− | <plugin id="com.xyz.myplugin" name="My Plugin" | + | <plugin id="com.xyz.myplugin" name="My Plugin" class="com.xyz.MyPlugin" version="1.0"> |
− | + | ||
<runtime> | <runtime> | ||
<library name="MyPlugin.jar"/> | <library name="MyPlugin.jar"/> | ||
Line 22: | Line 12: | ||
</plugin> | </plugin> | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | The processing instructions at the beginning specify the XML version and character encoding and that this plug-in was built for version 3.0 of the Eclipse Platform. The <tt>plugin</tt> element specifies the basic information about the plug-in, including, in this case, the optional <tt>class</tt> attribute to specify an instance of the <tt>Plugin</tt> class associated with this plug-in. Because it contains a subclass of <tt>Plugin</tt>, this plug-in must include a <tt>runtime</tt> element that specifies the JAR file that contains the code and a <tt>requires</tt> element to import the <tt>org.eclipse.core.runtime</tt> plug-in where the superclass resides. The manifest may also specify <i>extensions</i> and <i>extension points</i> associated with the plug-in. Of all this, only the <tt>plugin</tt> element with the <tt>id</tt>, <tt>name</tt>, and <tt>version</tt> attributes are required. | ||
== See Also: == | == See Also: == | ||
+ | *[[FAQ What is a plug-in?]] | ||
+ | *[[FAQ What are extensions and extension points?]] | ||
+ | *[[FAQ When does a plug-in get started?]] | ||
− | + | {{Template:FAQ_Tagline}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 05:00, 17 June 2006
The plug-in manifest file, plugin.xml, describes how the plug-in extends the platform, what extensions it publishes itself, and how it implements its functionality. The manifest file is written in XML and is parsed by the platform when the plug-in is loaded into the platform. All the information needed to display the plug-in in the UI, such as icons, menu items, and so on, is contained in the manifest file. The implementation code, found in a separate Java JAR file, is loaded when, and only when, the plug-in has to be run. This concept is referred to as lazy loading. Here is the manifest file for a simple plug-in:
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin id="com.xyz.myplugin" name="My Plugin" class="com.xyz.MyPlugin" version="1.0"> <runtime> <library name="MyPlugin.jar"/> </runtime> <requires> <import plugin="org.eclipse.core.runtime"/> </requires> </plugin>
The processing instructions at the beginning specify the XML version and character encoding and that this plug-in was built for version 3.0 of the Eclipse Platform. The plugin element specifies the basic information about the plug-in, including, in this case, the optional class attribute to specify an instance of the Plugin class associated with this plug-in. Because it contains a subclass of Plugin, this plug-in must include a runtime element that specifies the JAR file that contains the code and a requires element to import the org.eclipse.core.runtime plug-in where the superclass resides. The manifest may also specify extensions and extension points associated with the plug-in. Of all this, only the plugin element with the id, name, and version attributes are required.
See Also:
- FAQ What is a plug-in?
- FAQ What are extensions and extension points?
- FAQ When does a plug-in get started?
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.