Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to create two figures on a single Drag and drop in GEF?
How to create two figures on a single Drag and drop in GEF? [message #903287] Wed, 22 August 2012 21:07 Go to next message
Anbazhagan Jayachandran is currently offline Anbazhagan JayachandranFriend
Messages: 3
Registered: August 2012
Junior Member
I like to create two figure on a single drag and drop form the palette i.e At a single drag and drop two figures should be created both have separate EditPart and Model class.

Thanks in Advance
Re: How to create two figures on a single Drag and drop in GEF? [message #903546 is a reply to message #903287] Fri, 24 August 2012 08:50 Go to previous message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member

inserting of a new model is usually done in a command obtained from the target EditPart's layout policy's getCreateCommand(CreateRequest request).
The CreateRequest contains a CreationFactory which in turns creates the new model instance. Its default implementation caches the instance,
so you always get the same instance when you call createRequest.getNewObject().

If you need to create more than one model, you could ignore the createRequest.getNewObject() method and create the models instances by your self:
protected Command getCreateCommand(CreateRequest request) {
    Command command = null;

    if (request.getNewObjectType().equals(YourModel.class)) {
	command = new YourCommandForModelAdding(new YourModel(), new YourModel());
    return command;

you should also change the feedback (if you have some).
Previous Topic:Label with Icon problem
Next Topic:Text box using gef draw2d
Goto Forum:

Current Time: Tue Jun 19 12:40:47 GMT 2018

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

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

Back to the top