Difference between revisions of "Equinox Integration 2/Tutorial Plugin"
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
(→= Activation) |
(→Extension Points) |
||
(One intermediate revision by the same user not shown) | |||
Line 13: | Line 13: | ||
* Certainly you may implement the plain BundleActivator, but preferrably use org.adempiere.plugin.utils.AdempiereActivator | * Certainly you may implement the plain BundleActivator, but preferrably use org.adempiere.plugin.utils.AdempiereActivator | ||
** You have to import this package in the bundle manifest - it is provided by pluginUtils | ** You have to import this package in the bundle manifest - it is provided by pluginUtils | ||
+ | * The AdempiereActivator: | ||
+ | ** registeres your plugin as an ADempiere package | ||
+ | ** If you provide /META-INF/PackOut.xml in your plugin, it automagically does a 2Pack Packin with in. | ||
+ | * If nothing is to do on yours plugin start or stop, you may use AdempiereActivator itself as the activator of your plugin | ||
+ | * If you want to do something, subclass and override one of these methods: | ||
+ | ** install() - called after the packIn when your plugin is started in this version for the first time | ||
+ | ** start() - called - optionally after install() - when your plugin is started | ||
+ | ** stop() - called when your plugin is stopped | ||
+ | * You may use each of these utility methods: | ||
+ | ** getName() - name of the plugin | ||
+ | ** getVersion() - version of the plugin | ||
= Extension Points = | = Extension Points = | ||
+ | In a plugin, you can only change core functionality already prepared for modification. | ||
+ | These functionalities are exposed as extension points. As example, let us introduce a new callout. | ||
+ | * Open your plugins MANIFEST.MF | ||
+ | * You have to refer to the plugin providing the extension point, most often org.adempiere.base: | ||
+ | ** On Tab "Dependencies", click "Add.." | ||
+ | ** Choose the plugin and click "Ok" | ||
+ | * Now you have to declare your extension | ||
+ | ** If the tab "Extensions" is not already present, click on the link "Extensions" on the overview tab | ||
+ | ** On the "Extensions" tab, click "Add..." and choose the IColumnCallout Extension point | ||
+ | ** In the context menu of the point, choose "New/client" | ||
+ | ** In the "Extension Element Details", provide information about your callout: table and column and | ||
+ | ** the implementing class | ||
+ | * Use Eclipse magic to implement the callout: | ||
+ | ** simply click on the class-Link | ||
+ | ** watch the "New class" dialog open with the exact interface already provided. | ||
+ | ** So you only have to provide package and class name and start implementing! | ||
+ | * Simple, isn't it? | ||
---- | ---- |
Latest revision as of 03:05, 13 March 2010
If you want to change existing functionality in ADempiere, write a plugin. It is simple!
Create Plugin Project
- In Eclipse, chose New/Plugin Development/Plugin Project
- as a convention, choose a folder under adempiereTrunk/plugins
- The manifest editor opens, fill in appropriate attributes
- regarding versioning: I found the default versioning scheme using a qualifier (which is replaced by a timestamp at deployment time) quite annoying, because bundles are never overridden - but maybe I missed something here
Activation
- If you need action to be done, specify an activator in the manifest.
- Certainly you may implement the plain BundleActivator, but preferrably use org.adempiere.plugin.utils.AdempiereActivator
- You have to import this package in the bundle manifest - it is provided by pluginUtils
- The AdempiereActivator:
- registeres your plugin as an ADempiere package
- If you provide /META-INF/PackOut.xml in your plugin, it automagically does a 2Pack Packin with in.
- If nothing is to do on yours plugin start or stop, you may use AdempiereActivator itself as the activator of your plugin
- If you want to do something, subclass and override one of these methods:
- install() - called after the packIn when your plugin is started in this version for the first time
- start() - called - optionally after install() - when your plugin is started
- stop() - called when your plugin is stopped
- You may use each of these utility methods:
- getName() - name of the plugin
- getVersion() - version of the plugin
Extension Points
In a plugin, you can only change core functionality already prepared for modification. These functionalities are exposed as extension points. As example, let us introduce a new callout.
- Open your plugins MANIFEST.MF
- You have to refer to the plugin providing the extension point, most often org.adempiere.base:
- On Tab "Dependencies", click "Add.."
- Choose the plugin and click "Ok"
- Now you have to declare your extension
- If the tab "Extensions" is not already present, click on the link "Extensions" on the overview tab
- On the "Extensions" tab, click "Add..." and choose the IColumnCallout Extension point
- In the context menu of the point, choose "New/client"
- In the "Extension Element Details", provide information about your callout: table and column and
- the implementing class
- Use Eclipse magic to implement the callout:
- simply click on the class-Link
- watch the "New class" dialog open with the exact interface already provided.
- So you only have to provide package and class name and start implementing!
- Simple, isn't it?
Return to ADempiere/Equinox Integration 2