Here's a procedure for setting up IntelliJ IDEA.
See IDE setup for an alternative, using Gradle.
Installation and configuration
- Go to https://www.jetbrains.com/idea/download/
- Choose Community (direct download link for Windows: https://www.jetbrains.com/idea/download/download-thanks.html?platform=windows&code=IIC)
- Install IntelliJ IDEA (
Next
,Next
,Next
; the default options are fine) - Launch IntelliJ IDEA
- On the Welcome screen, choose
New Project
Name:
freeplane-scriptingLanguage:
JavaBuild system:
IntelliJJDK:
if none detected, selectDownload JDK
and choose version 17. AnyVendor:
will do. I choose Eclipse Temurin ...- Click
Create
- Once created, go to
File->Project structure (Ctrl+Alt+Shift+S)
- Then to
Modules
, and in the right pane toDependencies
- Click
+
in theDependencies
pane, select1 JARs or Directories
- Navigate to your Freeplane installation directory and select
freeplanelauncher.jar
(e.g.C:\Program Files\Freeplane\freeplanelauncher.jar
) - Again
+
1 JARs or Directories
C:\Program Files\Freeplane\core\org.freeplane.core\lib
- Once more
+
1 JARs or Directories
C:\Program Files\Freeplane\plugins\org.freeplane.plugin.script\lib
- Close the Project Structure window with
OK
at the bottom.
The installation is done. You are ready to start creating your first script.
Script example
In IntelliJ IDEA, right-click on the (blue) folder src New->File
and in the dialog write the name hello.groovy.
- In the file (right pane), start writing
def c = ScriptUtils
. A drop-down will appear. - Choose the (first) entry pointing to
org.freeplane.plugin.script.proxy
. It will add a line at the topimport org.freeplane.plugin.script.proxy.ScriptUtils
. - Continue writing in line 3. Put a dot after
ScriptUtils
and wait for a drop-down to appear. Selectc()
. - In the next line (4), write
def node = ScriptUtils.node()
- In a new line type
c.stat
and selectstatusInfo
. You can useDOWN
ENTER
or your mouse. - Then type
= "Hello. Current node id: ${node.id}
Verification in Freeplane
- Copy your script – select the file in the left pane and
Ctrl+C
- Go to your
<user-dir>/scripts
and paste itCtrl+V
- Alternatively, add your IDEA Project directory to Freeplane
Preferences…->Plugins->Scripting->Script search path (see tooltip)
- Restart Freeplane and run the script
Tools->Script->Hello
to verify it works OK