Skip to main content


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: 22
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: 811
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:Customize a Start Event Message
Next Topic:Creating a custom task with multiple visible elements
Goto Forum:
  


Current Time: Fri Apr 19 02:51:01 GMT 2024

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

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

Back to the top