I am trying to add a custom property tab only on a StartEvent object that contains a MessageEventDefinition.
I used the extension point org.eclipse.bpmn2.modeler.runtime and propertyTab element to do that. I set the type property to "org.eclipse.bpmn2.StartEvent" and check if the selected start event contains a message definition inside the appliesTo() method of my custom property section class that extends DefaultPropertySection.
When I create a new start event by dragging the Message Start Event of the jBPM tool palette (from Start Events category), the method appliesTo() is called but the start event does not contain any event definition at this time (I use the StartEvent.getEventDefinitions() method which returns an empty array). However, if I save the model, close it and re-open it, then when I select the start event, the event definition is here.
Robert Brodt Messages: 692 Registered: August 2010 Location: Colorado Springs, CO
This is because the toolpalette entry you are using is actually a "compound create feature" - it creates the StartEvent first, then the Event Definition. The appliesTo(EObject) method will be called several times during creation and will not see the Event Definition at first, but it should be there eventually
thanks for the answer.
In my appliesTo() method implementation, I returned true when I have a start event containing a message definition, and false otherwise. I modified my implementation and now it returns super.appliesTo() (from DefaultPropertySection) instead of returning false and it works. I think I bypassed the process when directly returning false.