This is an old revision of the document!
Plugin development
The following set of exercises aims at development of basic plugins to enable the editing and simulation of a new type of a graph model in Workcraft. Follow the step-by-step instructions to proceed from the initial setup of the project, all the way to the implementation of the model components, and simulation tools. Alternatively, if you wish to skip some of the steps, download the completed plugin source code at the end of each exercise.
Before continuing with these exercises make sure that you know how to build Workcraft from sources).
Project setup
For each exercise you will need to create a new project directory whose name starts with _
(an underscore) and finishes with Plugin
, e.g. _Exercise01Plugin
. Note that the directories starting with an underscore are automatically ignored both by Git and the distribution builder script, therefore this is a good way to add experimental plugins that should not become part of the main Workcraft build.
In the project directory create a build.gradle
file that specifies the project dependencies. Simple plugins only depend on the Workcraft framework, WorkcraftCore
project:
- build.gradle
dependencies { compile project(':WorkcraftCore') }
Now let us call the package for our Exercise01 plugin: org.workcraft.plugins.basic
. This follows Workcraft's standard of any new plugin to be packaged as org.workcraft.plugins.NewPluginName
and is typically where all the plugin classes will live. For this step, we create the directory src/org/workcraft/plugins/basic
under _Exercise01Plugin
.
To complete the set up, go to the top directory of Workcraft and follow either step depending on your development IDE:
For IntelliJ IDEA
- Run the
$./gradlew idea
command to generate the IntelliJ IDEA project with the newly created plugin. - Open the
workcraft.ipr
file in IDEA to load the project.
For Eclipse
- Run the
$./gradlew eclipse
command to generate the Eclipse project with the newly created plugin. - Once opening Eclipse, ensure that you have selected
workcraft
as the current Workspace directory and imported the project as necessary. For further information on this, see the Eclipse Integration page.
If everything has went smoothly, you are now set to go.