Difference between revisions of "Plugin development"

From Freeplane - free mind mapping and knowledge management software
Line 14: Line 14:
 
[create-plugin] => Optional: Does this plugin contribute to the GUI? (yes, no)
 
[create-plugin] => Optional: Does this plugin contribute to the GUI? (yes, no)
 
yes
 
yes
[create-plugin] => Optional: name of a new extension to define (xml element like 'icon')?
 
world
 
 
[create-plugin] New plugin created in C:\devel\freeplane-bazaar-repo\1_0_x\freeplane_plugin_helloworld
 
[create-plugin] New plugin created in C:\devel\freeplane-bazaar-repo\1_0_x\freeplane_plugin_helloworld
 
[create-plugin] What next?
 
[create-plugin] What next?
Line 39: Line 37:
 
<pre>
 
<pre>
 
   <target name="create-plugin-batch">
 
   <target name="create-plugin-batch">
     <create-plugin baseDir="." pluginname="helloworld" hasAction="true" extensionName="world" />
+
     <create-plugin baseDir="." pluginname="helloworld" hasAction="true" />
 
   </target>
 
   </target>
 
</pre>
 
</pre>

Revision as of 06:27, 7 June 2010

Create a new Plugin

A simple tool helps to get started with the development of plugins. It's an Ant Task named 'create-plugin' that is available from the freeplane_framework/ant directory.

Interactive

The task reads all required parameters from the command line by default. The following transcript shows input and output of a create-plugin invocation (Windows/Cygwin):

/devel/freeplane-bazaar-repo/1_0_x/freeplane_framework/ant $ ant create-plugin
Buildfile: build.xml

create-plugin:
[create-plugin] => Please enter required plugin name:
helloworld
[create-plugin] => Optional: Does this plugin contribute to the GUI? (yes, no)
yes
[create-plugin] New plugin created in C:\devel\freeplane-bazaar-repo\1_0_x\freeplane_plugin_helloworld
[create-plugin] What next?
[create-plugin] * import plugin into Eclipse via Import... -> Existing Projects into Workspace
[create-plugin] * add required external jars to C:\devel\freeplane-bazaar-repo\1_0_x\freeplane_plugin_helloworld\lib
[create-plugin] * add required external jars and required Freeplane projects to classpath
[create-plugin] * search for "TODO" in the project and fill the gaps
[create-plugin] * add the following element to freeplane_framework/ant/build.xml:
[create-plugin]   <antcall target="makePlugin" inheritall="false">
[create-plugin]     <param name="anttarget" value="dist"/>
[create-plugin]     <param name="targetdir" value="plugins"/>
[create-plugin]     <param name="plugindir" value="freeplane_plugin_helloworld"/>
[create-plugin]     <param name="pluginname" value="org.freeplane.plugin.helloworld"/>
[create-plugin]   </antcall>

Follow the suggestions in the printed message.


Non-interactive

If you want to do it non-interactively instead you have to create your own (temporary) Ant task in freeplane_framework/ant/build.xml like this:

  <target name="create-plugin-batch">
    <create-plugin baseDir="." pluginname="helloworld" hasAction="true" />
  </target>