|
Re: how to add a new attribute to the bpmn2 model without any extension [message #1067973 is a reply to message #1067965] |
Thu, 11 July 2013 13:47 |
|
Most of the bpmn2 elements have their own property tabs. For the User Task, the property tab is defined in the org.eclipse.bpmn2.modeler.ui plugin.xml and looks like this:
<propertyTab
id="org.eclipse.bpmn2.modeler.userTask.tab"
replaceTab="org.eclipse.bpmn2.modeler.task.tab"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
class="default"
features="implementation resources renderings isForCompensation"
type="org.eclipse.bpmn2.UserTask"
label="User Task">
</propertyTab>
where the class="default" means "use the default detail composite class, DefaultDetailComposite" and the features="implementation ...etc." indicates the class features that are to be rendered. The default detail composite recognizes various feature types, like boolean string, references, list, etc. (see the ObjectEditor base class and all of its subclasses).
You'll have to add your new class feature to this list if you want it to show up in the property tab. Alternatively you could write your own custom detail class - there are many examples of this already in the editor code.
Have fun!
Bob
|
|
|
|
|
|
Re: how to add a new attribute to the bpmn2 model without any extension [message #1137751 is a reply to message #1133059] |
Mon, 14 October 2013 18:12 |
|
Hi Katharina,
Unless you need a special data type or require special property display and validation, you can simply define a <modelExtension> for this attribute in your plugin.xml.
So, for example you could add this to your plugin.xml:
<modelExtension
id="org.eclipse.bpmn2.modeler.runtime.example.modelExtension.ManualTask"
runtimeId="org.eclipse.bpmn2.modeler.runtime.example"
name="Manual Task Extensions"
type="ManualTask">
<property name="timeToComplete" value="3 hours" type="EString"/>
</modelExtension>
Be careful though because this will add the extension attribute to all instances of the same BPMN2 element type. So in this case, all ManualTask objects will have a "timeToComplete" extension attribute added to them.
You will also have to add a <modelEnablement> entry for this attribute if you want it to show up as an editable field in the Property Tab, like this:
<modelEnablement runtimeId="org.eclipse.bpmn2.modeler.runtime.example" type="Process" profile="Default">
<enable object="ManualTask" feature="timeToComplete"/>
</modelEnablement>
When this object is serialized, it will look like this in the *.bpmn file:
<bpmn2:manualTask id="ManualTask_1" tns:timeToComplete="3 hours" name="Manual Task 1"/>
where the "tns" is the URI of your Target Runtime plugin's <model>, e.g.:
<model runtimeId="org.eclipse.bpmn2.modeler.runtime.example"
uri="http://org.eclipse.bpmn2.modeler.runtime.example"
resourceFactory="...">
</model>
HTH,
Bob
|
|
|
|
Powered by
FUDForum. Page generated in 0.04345 seconds