Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "BPMN2-Modeler/DeveloperTutorials/ToolPaletteFragments"

(Created page with "== Adding Workflow Snippets to the Tool Palette ==")
 
Line 1: Line 1:
== Adding Workflow Snippets to the Tool Palette ==
+
== Tool Palette Fragments ==
 +
The BPMN2 Modeler's Tool Palette is extremely flexible and can be extended with user-defined "snippets" or compound tool items. The "Workflow Patterns" Tool Drawer is an example of this type of extension. Please use the [[BPMN2-Modeler/DeveloperTutorials/ExtensionPoints| Core Extension Points]] document as a reference.
 +
 
 +
In this tutorial we will be using the BPMN2 Modeler's ".bpmn2config" configuration folder to define some BPMN2 snippets for the Tool Palette, simply because this will be an iterative process and changing some XML in a file is much faster than rebuilding and running an editor extension plugin.
 +
 
 +
Create a new "General Project" and then create a folder named ".bpmn2config" in the project root. In this folder, create a new file named "snippets.xml" - this is where we will define the BPMN2 snippets. Copy and paste the following text into snippets.xml:
 +
 
 +
<pre>
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
 
 +
<runtime id="org.eclipse.bpmn2.modeler.runtime.none">
 +
<toolPalette
 +
id="org.bpmn2.modeler.toolpalette.my.full"
 +
profile="Full">
 +
 
 +
<category id="org.bpmn2.modeler.toolpalette.default.categories"/>
 +
<category id="org.bpmn2.modeler.toolpalette.my.snippets" name="Snippets">
 +
<tool name="Parallel Join" id="org.bpmn2.modeler.tool.parallel.join">
 +
<object type="Task[$name='Task A']" id="parallel.join.taskA"/>
 +
<object type="Task[$name='Task B',y=100]" id="parallel.join.taskB"/>
 +
<object type="Task[$name='Task C',x=200,y=50]" id="parallel.join.taskC"/>
 +
</tool>
 +
</category>
 +
 +
</toolPalette>
 +
 +
</runtime>
 +
</pre>
 +
 
 +
This XML deserves some explanation:
 +
* Since we are not too concerned about defining our own extension plugin at this time, we will simply extend the "None" or default runtime behavior of the editor. This is identified by the first element ('''runtime''') in this example - the '''id''' "org.eclipse.bpmn2.modeler.runtime.none" is  the unique ID for the "None" runtime.
 +
* The next element ('''toolPalette''') defines a Tool Palette extension. The '''id''' is required and uniquely identifies this Tool Palette. The '''profile''' is also required and references a Tool Profile defined in the "None" runtime.
 +
* The '''category''' elements correspond to Tool Palette "drawers". These are the groupings of tool items, for example "Tasks", "Gateways" and "Events" and are identified in the Tool Palette by a folder icon. The first '''category''' in the above XML references a default set of Tool Palette Drawers which includes all of the BPMN2 modeling elements. Whether or not a tool item is visible in its tool drawer depends on the '''modelEnablement''' extension. See the Extension Point Schema document for more information.
 +
* The second '''category''' element is where we will add our tool items. Again, an '''id''' and '''name''' are required for this element.
 +
* The '''tool''' element defines a tool drawer tool that, when clicked and dragged onto the canvas, will create one or more BPMN2 modeling elements on the canvas.
 +
* Since a tool drawer may contain many tool items, our '''category''' element will contain one or more '''tool''' item definitions, but for now we will concentrate on only one '''tool''' entry.
 +
* Each '''tool''' will have one or more '''object''' definition elements. These are the elements that are used to define the BPMN2 model object (or objects) that the tool will create. In this example, the

Revision as of 16:00, 29 February 2016

Tool Palette Fragments

The BPMN2 Modeler's Tool Palette is extremely flexible and can be extended with user-defined "snippets" or compound tool items. The "Workflow Patterns" Tool Drawer is an example of this type of extension. Please use the Core Extension Points document as a reference.

In this tutorial we will be using the BPMN2 Modeler's ".bpmn2config" configuration folder to define some BPMN2 snippets for the Tool Palette, simply because this will be an iterative process and changing some XML in a file is much faster than rebuilding and running an editor extension plugin.

Create a new "General Project" and then create a folder named ".bpmn2config" in the project root. In this folder, create a new file named "snippets.xml" - this is where we will define the BPMN2 snippets. Copy and paste the following text into snippets.xml:

<?xml version="1.0" encoding="UTF-8"?>

<runtime id="org.eclipse.bpmn2.modeler.runtime.none">
		<toolPalette
			id="org.bpmn2.modeler.toolpalette.my.full"
			profile="Full">

			<category id="org.bpmn2.modeler.toolpalette.default.categories"/>
			<category id="org.bpmn2.modeler.toolpalette.my.snippets" name="Snippets">
				<tool name="Parallel Join" id="org.bpmn2.modeler.tool.parallel.join">
					<object type="Task[$name='Task A']" id="parallel.join.taskA"/>
					<object type="Task[$name='Task B',y=100]" id="parallel.join.taskB"/>
					<object type="Task[$name='Task C',x=200,y=50]" id="parallel.join.taskC"/>
				</tool>
			</category>
			
		</toolPalette>
		
</runtime>

This XML deserves some explanation:

  • Since we are not too concerned about defining our own extension plugin at this time, we will simply extend the "None" or default runtime behavior of the editor. This is identified by the first element (runtime) in this example - the id "org.eclipse.bpmn2.modeler.runtime.none" is the unique ID for the "None" runtime.
  • The next element (toolPalette) defines a Tool Palette extension. The id is required and uniquely identifies this Tool Palette. The profile is also required and references a Tool Profile defined in the "None" runtime.
  • The category elements correspond to Tool Palette "drawers". These are the groupings of tool items, for example "Tasks", "Gateways" and "Events" and are identified in the Tool Palette by a folder icon. The first category in the above XML references a default set of Tool Palette Drawers which includes all of the BPMN2 modeling elements. Whether or not a tool item is visible in its tool drawer depends on the modelEnablement extension. See the Extension Point Schema document for more information.
  • The second category element is where we will add our tool items. Again, an id and name are required for this element.
  • The tool element defines a tool drawer tool that, when clicked and dragged onto the canvas, will create one or more BPMN2 modeling elements on the canvas.
  • Since a tool drawer may contain many tool items, our category element will contain one or more tool item definitions, but for now we will concentrate on only one tool entry.
  • Each tool will have one or more object definition elements. These are the elements that are used to define the BPMN2 model object (or objects) that the tool will create. In this example, the

Back to the top