Difference between revisions of "Add-ons (Develop)"

From Freeplane - free mind mapping and knowledge management software
(Steps towards your own add-on)
m (Steps towards your own add-on)
Line 7: Line 7:
 
==Steps towards your own add-on==
 
==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>.
+
The goal of the add-on is to put:
 +
#a script <tt>myCoolScript.groovy</tt> in <tt><freeplaneuserdir>/script/myCoolScript.groovy</tt>; and
 +
#an icon <tt>mycoolicon.png</tt> in <tt><freeplaneuserdir>/icons/mycoolicon.png</tt>.
 +
 
  
 
First download 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. An easy way to do so:
 
First download 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. An easy way to do so:
Line 18: Line 21:
 
#Restart Freeplane
 
#Restart Freeplane
 
#The add-on functions are available in: ''Tools > Developer tools''
 
#The add-on functions are available in: ''Tools > Developer tools''
 +
  
 
Next define your add-on
 
Next define your add-on

Revision as of 19:31, 19 November 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). They may contain any number of scripts and Zip archives which are unpacked on installation. Combinations of scripts and Zips especially interesting since this enables you to package scripts with required libraries/JARs/class files. For instance it's possible to bundle some Groovy scripts for creating diagrams 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

The goal of the add-on is to put:

  1. a script myCoolScript.groovy in <freeplaneuserdir>/script/myCoolScript.groovy; and
  2. an icon mycoolicon.png in <freeplaneuserdir>/icons/mycoolicon.png.


First download the Developer Tools from the Add-ons page. It provides scripts that relieves you from most of the tedious work. An easy way to do so:

  1. In Freeplane select Tools > Add-ons > Search add-ons > Visist add-on page
  2. Search your add-on; choose download
  3. Save the add-on on your computer, e.g. on the desktop
  4. Select Tools > Addons > Search and install
  5. Select directory icon ; find and select the file you just downloaded (e.g. on your desktop)
  6. Select Install
  7. Restart Freeplane
  8. The add-on functions are available in: Tools > Developer tools


Next define your add-on

  1. In Freeplane create a new empty map by Ctrl+n.
  2. Invoke Tools->Developer Tools->Build add-on. You will be asked for the name of your add-on. Answer My Cool Add-on
  3. Look through the messages in the info box that is shown 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.
  4. Set the version attribute of the root node to v0.1
  5. Create a new directory somewhere with the technical name of the add-on, myCoolAddOn.
  6. Save the new map to myCoolAddOn/myCoolAddOn.mm.
  7. Copy myCoolScript.groovy to myCoolAddOn/scripts/myCoolScript.groovy.
  8. In the map create a new subnode of the scripts node with name myCoolScript.groovy.
  9. Copy mycoolicon.png to zips/icons/mycoolicon.png.
  10. In the map create a new subnode of the zips node with name icons. Create a mycoolicon.png subnode under icons. The node hierarchy then is zips->icons->mycoolicon.png.
  11. 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 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.