Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Infinite loop when creating a custom task
Infinite loop when creating a custom task [message #1259321] Fri, 28 February 2014 08:54 Go to next message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 15
Registered: December 2013
Junior Member
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 Rolling Eyes

@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
Re: Infinite loop when creating a custom task [message #1260539 is a reply to message #1259321] Sat, 01 March 2014 16:05 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 616
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Cédric,

Hmm, this doesn't look good Sad I'll take a look at this over the weekend and hopefully figure out what's going on here...

Bob
Previous Topic:Issue in CallActivity of a Process
Next Topic:Simulation in BPMN2.0 modeler
Goto Forum:
  


Current Time: Sat Nov 22 17:04:33 GMT 2014

Powered by FUDForum. Page generated in 0.05263 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software