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:Tutorial: How to add PopUp Menu..?
Next Topic:GEF Flow example
Goto Forum:
  


Current Time: Tue Apr 23 07:37:24 GMT 2024

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

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

Back to the top