Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » EditPart Creation Question
EditPart Creation Question [message #217870] Wed, 14 June 2006 16:05 Go to next message
Spirit is currently offline SpiritFriend
Messages: 15
Registered: July 2009
Junior Member
Usually we create a new editpart by dragging from or clicking on the
ToolEntry of the Palette, but if I want to create one without doing that,
say, when processing a file,what I should do?

That's to say : How can I generate a CreationRequest without touching the
Palette ?

Any help would be appreciated :-)
Re: EditPart Creation Question [message #217905 is a reply to message #217870] Wed, 14 June 2006 17:24 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
You need to similate what the CreationTool is doing for your action.
Construct the CreationRequest, get the command from the target EditPart,
then execute the command on the command stack...

i.e.

CreateRequest request = new CreateRequest();
request.setFactory(new SimpleFactory( <your model class to create> );
request.setLocation( <absolute coordinate where you want to place the
shape> );
request.setSize( <absolute dimenstion of the shape> );
Command cmd = targetEP.getCommand(request);
if (cmd != null && cmd.canExecute())
getDomain().getCommandStack().execute(command);

Regards,

Steve.



"
Re: EditPart Creation Question [message #217936 is a reply to message #217905] Thu, 15 June 2006 04:01 Go to previous message
Spirit is currently offline SpiritFriend
Messages: 15
Registered: July 2009
Junior Member
Thanks a lot :-)

"Steven Shaw" <steveshaw@ca.ibm.com> ะด
Previous Topic:Indicate GEF command did nothing to stack?
Next Topic:need Help for Loop connection
Goto Forum:
  


Current Time: Thu Dec 01 15:00:38 GMT 2022

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

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

Back to the top