Hi Bob,
hope your work on extending the model is progressing well.
I try to implement a "Message Start Event" with the custom task mechanism. My feature container looks like this:
public class MessageStartEventFeatureContainer extends CustomShapeFeatureContainer
{
@Override
protected IFeatureContainer createFeatureContainer(IFeatureProvider fp)
{
// create the feature container delegate
return new StartEventFeatureContainer()
{
@Override
public ICreateFeature getCreateFeature(IFeatureProvider fp)
{
return new CreateMessageStartEventFeature(fp);
}
@Override
public IAddFeature getAddFeature(IFeatureProvider fp)
{
return new AddMessageStartEventFeature(fp);
}
};
}
}
The AddMessageStartEventFeature class extends the AddEventFeature<StartEvent> class. When I create a new Message Start Event from the tool palette based on this feature container, I enter an infinite loop because at the end of the AddEventFeature.add() method, the following line keeps on calling my AddMessageStartEventFeature.add() method:
this.getFeatureProvider().getAddFeature(context).add(context);
I made a hack in my add() method to stop the loop, but I am not very proud of it
@Override
public PictogramElement add(IAddContext context)
{
// Put a property in the context the first time the object is added to avoid infinite loop
if (context.getProperty("MESSAGE_START_EVENT_ADD") == null)
{
context.putProperty("MESSAGE_START_EVENT_ADD", true);
return super.add(context);
}
return null;
}
Is there a better way to reuse the AddEventFeature class in my feature container ?
Thanks