STP/BPMN Component/Reusing the modeler
Annotating the stp.bpmn domain model
This paragraph explains how to add to the bpmn diagram custom data. It also describes how to display and interact with that custom data.
The reader needs to be familiar with EMF and in some cases to GMF/GEF.
Every element of the domain model of the stp.bpmn modeler is an EMF EModelElement. This means that it can be attached arbitrary annotations.
Here are various techniques to use that ability.
Display the value of the annotation
By default the EAnnotations added to the bpmn objects are displayed in the properties view inside the 'BPMN' tabulation.
EAnnotations are tied to their EModelElement through the source property which is a String. EAnnotations contain a HashMap of Strings to Strings.
The BPMN properties view display a table with two columns: The first column is the source of the EAnnotation concatenated to the key of the Details HashMap.
The second column is the value of the Details HashMap.
Displaying the annotation on the diagram
Once the model has annotations it is possible to display in the diagram that the model element associated to a particular shape or connection has been annotated. In order to do this, we have implemented an extension point: org.eclipse.stp.bpmn.diagram.EAnnotationDecorator.
Annotate the stp.bpmn: Drag and Drop
It is possible to drag and drop things to attach annotations to the stp.bpmn domain model. Use the extension point: org.eclipse.stp.bpmn.diagram.EAnnotationDragAndDrop The object dragged must be "IAdaptable" to an EAnnotation. The implementation of the extension point will define if the drop can execute and will show feedback in a balloon figure. This extension point is only giving access to the domain model.
To extend the drag and drop, you will need to declare three extension points.
TODO add links to the respective docs
<DropHandler class="org.eclipse.stp.bpmn.dnd.file.FileDndHandler" source="genericFile"> </DropHandler> </extension> <extension point="org.eclipse.stp.bpmn.diagram.EAnnotationDecorator"> <decorator class="org.eclipse.stp.bpmn.dnd.file.FileEAnnotationDecorator" source="genericFile"> </decorator> </extension> <extension point="org.eclipse.core.runtime.adapters"> <factory adaptableType="org.eclipse.core.resources.IFile" class="org.eclipse.stp.bpmn.dnd.file.File2AnnotationAdapterFactory"> <adapter type="org.eclipse.emf.ecore.EAnnotation"> </adapter> </factory> </extension>
The hardcore way to customize the editor consist of making your own BPMN Editor with its own EditPart factory. All you need to do is extend the stp.bpmn Editor and EditPartFactory.
We have made many packages public for now.
Also GMF validation services are very useful when adding extra rules are to analyze the code.
As we identify implementation of those services that are specialized to the stp.bpmn model they will be exposed as extension points.