Contents OSGi Introducing MANIFEST.MF Eclipse Plug-ins 2 plugin.xml OSGi MANIFEST.MF Manifest-Version: 1.0 OSGi is a Java-based framework targeted Bundle-ManifestVersion: 2 for use by systems that require long Bundle-Name: HelloPlugin Plug-in Bundle-SymbolicName: org.eclipse.course.helloplugin; singleton :=true running times, dynamic updates, and Bundle-Version: 1.0.0 minimal disruptions to the running Bundle-ClassPath: helloplugin.jar Bundle-Activator: org.eclipse.course.helloplugin.Activator environment. Bundle-Vendor: Eclipse Tutorial Bundle-Localization: plugin An Eclipse Plug-in is an OSGi Bundle with Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime Eclipse-LazyStart: true some distinct Eclipse specifics. 1
MANIFEST.MF MANIFEST.MF Manifest-Version: 1.0 Bundle-Name: HelloPlugin Plug-in Bundle-SymbolicName: Bundle-ManifestVersion: 2 org.eclipse.course.helloplugin; singleton :=true Header defined by OSGi R4 (used by The name of the bundle, a human-readable text. Eclipse). The plug-in id, uniquely identify the plug-in and is typically constructed using Java package naming conventions. MANIFEST.MF MANIFEST.MF Bundle-Version: 1.0.0 Bundle-ClassPath: helloplugin.jar The version of the bundle, major version This property specifies the CLASSPATH number, minor version number, and to use for the bundle. The property may service level. contain references to directories or jar files inside the bundle jar file. 2
MANIFEST.MF MANIFEST.MF Bundle-Vendor: Eclipse Tutorial Bundle-Activator: org.eclipse.course.helloplugin.Activator Bundle-Localization: plugin The bundle vendor in a human-readable This class is used to start and stop the text. bundle. The location for the localization data, it defaults to plugin (i.e. plugin.properties). MANIFEST.MF MANIFEST.MF Require-Bundle: org.eclipse.ui, If a plug-in has been successfully compiled and org.eclipse.core.runtime built but, during execution, throws a NoClassDefFoundError, it may indicate that the Eclipse-LazyStart: true plug-in project's Java classpath is out of sync with the Require-Bundle declaration in the This property specifies which bundles and their MANIFEST.MF file. exported packages to import for use in the given It is important to keep the classpath and the bundle. Require-Bundle declaration in sync. Makes the plug-in to be lazily loaded by Eclipse. 3
plugin.xml plugin.xml <?xml version="1.0" encoding="UTF-8"?> A plug-in can provide an extension to be <?eclipse version="3.2"?> used by other plug-ins. <plugin> It needs to create an extension point schema and declares it in plugin.xml. <extension point="org.eclipse.ui.actionSets"> ... But usually we create plug-ins to extend </extension> Eclipse functionalities. </plugin> plugin.xml plugin.xml actionSet: This element is used to define a We use org.eclipse.ui.actionSets to group of actions and/or menus. provide a new action (button or menu). label: a translatable name used by the <extension Workbench to represent this action set to the point="org.eclipse.ui.actionSets"> … user. </extension> visible: an optional attribute indicating whether the action set is initially visible when a perspective is open. id: a unique identifier for this action set. 4
plugin.xml plugin.xml action: This element defines an action that menu: This element is used to defined a the user can invoke in the UI. new menu. label: a translatable name used either as label: a translatable name used by the the menu item text or toolbar button label. Workbench for this new menu. The name The name can include mnenomic should include mnemonic information. information. id: a unique identifier that can be used to icon: a relative path of an icon used to reference this menu. visually represent the action in its context. plugin.xml plugin.xml class: a fully qualified name of a class which menubarPath: a slash-delimited path ('/') implements org.eclipse.ui. used to specify the location of this action IWorkbenchWindowActionDelegate or org.eclipse.ui. in the menu bar. IWorkbenchWindowPulldownDelegate. toolbarPath: a slash-delimited path ('/') that tooltip: a translatable text representing the action's tool tip. Only used if the action appears is used to specify the location of this action in the toolbar. in the toolbar. id: unique identifier used as a reference for this action. 5
Recommend
More recommend