05_developer_tutorials:02_extending_groimp:add-templates-and-examples
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| 05_developer_tutorials:02_extending_groimp:add-templates-and-examples [2025/01/31 14:03] – removed - external edit (Unknown date) 127.0.0.1 | 05_developer_tutorials:02_extending_groimp:add-templates-and-examples [2025/01/31 14:03] (current) – ↷ Page moved from 05_developer_tutorials:add-templates-and-examples to 05_developer_tutorials:02_extending_groimp:add-templates-and-examples tim2 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Add templates and examples ===== | ||
| + | The CLI and the API use the same way to load examples and templates, this way is different from the way currently used in the gui. **Therefore the examples and templates added as follows will not show in the GUI.** | ||
| + | |||
| + | |||
| + | For the CLI and the API a template or an example is just a .gsz file that is added to the registry. | ||
| + | |||
| + | |||
| + | It is possible to add examples and templates to an existing plugin or to create a simple new one. | ||
| + | |||
| + | ==== Create a new plugin ==== | ||
| + | |||
| + | Since this new plugin will not contain any java code and does not need to be compiled the file structure is very simple: | ||
| + | |||
| + | * myPlugin: | ||
| + | * pluin.xml | ||
| + | * plugin.properties | ||
| + | * myTemplate.gsz | ||
| + | * myExample.gsz | ||
| + | |||
| + | |||
| + | ==== adding to the Registry ==== | ||
| + | |||
| + | The registry contains a directory for examples and one for templates. New gsz files can be added using the FilterSourceFactory with a resource as shown in the following. | ||
| + | |||
| + | <code xml> | ||
| + | <?xml version=" | ||
| + | <plugin | ||
| + | id=" | ||
| + | version=" | ||
| + | xmlns=" | ||
| + | < | ||
| + | <ref name=" | ||
| + | <ref name=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Additionally, | ||
| + | |||
| + | <code properties> | ||
| + | pluginName = myPlugin | ||
| + | provider = grogra.de | ||
| + | |||
| + | |||
| + | / | ||
| + | / | ||
| + | / | ||
| + | |||
| + | |||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Adding templates or examples to a Plugin with code ==== | ||
| + | |||
| + | If your plugin already contain java code and must be compiled the steps above are the same except that the .gsz files must be stored in src/ | ||
| + | |||
| + | * myPlugin | ||
| + | * pom.xml | ||
| + | * src | ||
| + | * main | ||
| + | * java | ||
| + | * de/ | ||
| + | * resources | ||
| + | * plugin.properties | ||
| + | * plugin.xml | ||
| + | * myTemplate.gsz | ||
| + | * myExample.gsz | ||
| + | * assembly | ||
| + | * < | ||
| + | |||
| + | === Attatchments === | ||
| + | |||
| + | An example for that can be found [[https:// | ||
