Difference between revisions of "Add-ons (Develop)"
Line 5: | Line 5: | ||
Add-ons may contain any number of scripts and Zip files to be unpacked in the Freeplane user directory. Combinations are especially interesting since this enables you to package scripts with required libraries/JARs/class files. So it's possible to bundle some Groovy scripts with the JFreechart library - so there's no need to download and install the JFreechart libraries anymore. | Add-ons may contain any number of scripts and Zip files to be unpacked in the Freeplane user directory. Combinations are especially interesting since this enables you to package scripts with required libraries/JARs/class files. So it's possible to bundle some Groovy scripts with the JFreechart library - so there's no need to download and install the JFreechart libraries anymore. | ||
− | Since plugins may also be installed into the Freeplane user directory, add-ons may even provide plugins | + | Since plugins (such as the Scripting, LaTeX or Formula plugin you know) may also be installed into the Freeplane user directory, add-ons may even provide plugins. |
− | + | ==Steps towards your own add-on== | |
− | + | Let's assume you have a script <tt>myCoolScript.groovy</tt> that you want to provide as an add-on. Furthermore let's assume that the script needs an icon <tt>mycoolicon.png</tt>. While development these files reside in <tt><freeplaneuserdir>/script/myCoolScript.groovy</tt> and <tt><freeplaneuserdir>/icons/mycoolicon.png</tt>. | |
+ | |||
+ | # Install the [http://freeplane.sourceforge.net/wiki/index.php/Add-ons#Add-on_Insert_Inline_Image Developer Tools] from the [[Add-ons]] page. It provides scripts that relieves you from most of the tedious work. | ||
+ | # In Freeplane create a new empty map by ''Ctrl+n''. | ||
+ | # Invoke ''Tools->Developer Tools->Build add-on''. You will be asked for the name of your add-on. Answer ''My Cool Add-on'' | ||
+ | # Look through the messages printed in the info box if everything looks alright. The ''name'' attribute of the root node will be ''myCoolAddOn''. This is the identifying technical name of the add-on while ''My Cool Add-on'' will be subject to translation. | ||
+ | # Set the version attribute of the root node to <tt>v0.1</tt> | ||
+ | # Create a new directory somewhere with the technical name of the add-on, <tt>myCoolAddOn</tt>. | ||
+ | # Save the new map to <tt>myCoolAddOn/myCoolAddOn.mm</tt>. | ||
+ | # Copy <tt>myCoolScript.groovy</tt> to <tt>myCoolAddOn/scripts/myCoolScript.groovy</tt>. | ||
+ | # In the map create a new subnode of the ''scripts'' node with name ''myCoolScript.groovy''. | ||
+ | # Copy <tt>mycoolicon.png</tt> to <tt>zips/icons/mycoolicon.png</tt>. | ||
+ | # In the map create a new subnode of the ''zips'' node with name ''icons''. Create a ''mycoolicon.png'' subnode under ''icons''. | ||
+ | # Invoke ''Package add-on for publication''. This will create the file <tt>myCoolAddOn-v0.1.mm</tt> which can be installed via ''Tools->Scripts->Install Add-on'' (or via ''Tools->Add-ons''). | ||
+ | |||
+ | But before publishing your add-on you should read all notes in the add-on map. They are meant for developers, not for users since users are not expected to read an add-on package. The notes should guide you to add all missing information. | ||
[[Category:Developer_Documentation]] | [[Category:Developer_Documentation]] |
Revision as of 03:02, 30 October 2011
This page will provide detailed information about developing Freeplane add-ons.
Add-ons are installed in the Freeplane user directory (see Tools->Open user directory). An add-on is a package of some or all of these features, which can be installed at once.
Add-ons may contain any number of scripts and Zip files to be unpacked in the Freeplane user directory. Combinations are especially interesting since this enables you to package scripts with required libraries/JARs/class files. So it's possible to bundle some Groovy scripts with the JFreechart library - so there's no need to download and install the JFreechart libraries anymore.
Since plugins (such as the Scripting, LaTeX or Formula plugin you know) may also be installed into the Freeplane user directory, add-ons may even provide plugins.
Steps towards your own add-on
Let's assume you have a script myCoolScript.groovy that you want to provide as an add-on. Furthermore let's assume that the script needs an icon mycoolicon.png. While development these files reside in <freeplaneuserdir>/script/myCoolScript.groovy and <freeplaneuserdir>/icons/mycoolicon.png.
- Install the Developer Tools from the Add-ons page. It provides scripts that relieves you from most of the tedious work.
- In Freeplane create a new empty map by Ctrl+n.
- Invoke Tools->Developer Tools->Build add-on. You will be asked for the name of your add-on. Answer My Cool Add-on
- Look through the messages printed in the info box if everything looks alright. The name attribute of the root node will be myCoolAddOn. This is the identifying technical name of the add-on while My Cool Add-on will be subject to translation.
- Set the version attribute of the root node to v0.1
- Create a new directory somewhere with the technical name of the add-on, myCoolAddOn.
- Save the new map to myCoolAddOn/myCoolAddOn.mm.
- Copy myCoolScript.groovy to myCoolAddOn/scripts/myCoolScript.groovy.
- In the map create a new subnode of the scripts node with name myCoolScript.groovy.
- Copy mycoolicon.png to zips/icons/mycoolicon.png.
- In the map create a new subnode of the zips node with name icons. Create a mycoolicon.png subnode under icons.
- Invoke Package add-on for publication. This will create the file myCoolAddOn-v0.1.mm which can be installed via Tools->Scripts->Install Add-on (or via Tools->Add-ons).
But before publishing your add-on you should read all notes in the add-on map. They are meant for developers, not for users since users are not expected to read an add-on package. The notes should guide you to add all missing information.