Introduction
This page details how to create a new plug-in, in order to extend the GAML language with new skills (and thus actions) and new operators. We consider that the developper version of GAMA has been installed (as detailled in this tutorial).
Details
Here are detailled steps to create and configure a new plug-in.
- File > New > Project > plug-in project
- In the "New plug-in Project" / "Plug-in project" window:
- Choose as name « name_of_the_plugin » (or anything else)
- Check "Use défaut location"
- Check "Create a Java Project"
- The project should be targeted to run with Eclipse
- working set (if any, in my case I had not one)
- Click on "Next"
- In the "New plug-in Project" / "Content" window:
- Id : could contain the name of your institution and/or your project, e.g. « irit.maelia.gaml.additions »
- version 1.0.0
- Name « Additions to GAML from Maelia project »
- Uncheck "Generate an activator, a Java class that controls the plug-in's life cycle" ,
- Uncheck "This plug-in will make contributions to the UI"
- Check "No" when its asks "Would you like to create a rich client application ?"
- Click on "Next"
- In the "New plug-in Project" / "Templates" window:
- Uncheck "Create a plug-in using one of the templates"
- Click on "Finish"
Your plug-in has been created.
- Edit the file "Manifest.MF":
- Overview pane: check « This plug-in is a singleton »
- Dependencies pane: add (at least minimum) the two plug-ins "msi.gama.core" and "msi.gama.processor" in the "Required Plug-ins". When you click on "Add", a new window will appear without any plug-in. Just write the beginning of the plug-in name in the text field under "Select a plu-in".
- Runtime pane:
- In exported Packages: nothing (but when you will have implented new packages in the plug-in you should add them their)
- Add in the classpath all the additional libraries (.jar files) used in the project.
- Extensions pane: "Add" "gaml.grammar.addition"
- Save the file. This should create a "plugin.xml" file.
- Select the project and in menu Project > Properties:
- Java Compiler > Annotation Processing: check "Enable project specific settings", then in "Generated Source Directory", change ".apt_generated" in "gaml",
- Java Compiler > Annotation Processing > Factory path: check "Enable project specific settings", then "Add Jars" and choose "msi.gama.processor/processor/plugins/mis.gama.processor.1.4.0.jar"
The plug-in is ready to accept any addition to the GAML language, e.g. skills, actions, operators
To test the plug-in, 2 possibilities:
- Open the existing "gama1.4.product" and add the new plug-in
- Create a new .product file in msi.gama.application that contains all the necessary plug-ins and the one just developped.
Do not forget to add the created packages that could be used by "clients", especially all packages containing new GAML primitives in the plugin.xml of the new project.