Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to add figures programmatically
How to add figures programmatically [message #162448] Tue, 21 December 2004 23:38 Go to next message
Christian Hauser is currently offline Christian HauserFriend
Messages: 189
Registered: July 2009
Senior Member
Hi,

I'd like to programmatically add figures to the diagram using the
commands that GEF uses.

How can I add an AbstractGraphicalEditPart to the diagram without using
the palette to manually add an edit part. I'd like to use the same
commands (extending org.eclipse.gef.commands.Command) that would be
returned from the various methods of XYLayoutEditPolicy.

I know how to create a command, but don't know what to do with it in my
action.

I'd be very happy if someone could help me put editparts into the
diagram from within an action.

Thanks in advance for any hint,

Christian
Re: How to add figures programmatically [message #162463 is a reply to message #162448] Wed, 22 December 2004 00:10 Go to previous messageGo to next message
Rob Grzywinski is currently offline Rob GrzywinskiFriend
Messages: 29
Registered: July 2009
Junior Member
> I'd like to programmatically add figures to the diagram using the commands
> that GEF uses.
>
> How can I add an AbstractGraphicalEditPart to the diagram without using
> the palette to manually add an edit part. I'd like to use the same
> commands (extending org.eclipse.gef.commands.Command) that would be
> returned from the various methods of XYLayoutEditPolicy.

One nice thing about Eclipse is that you can follow the call path into the
GEF source if you need to. Following the call path for
EditPart.getCommand(...) you end up in AbstractTool.executeCurrentCommand()
which points you to the CommandStack which is retrieved from the EditDomain.
So at the end of the day you just need to:

commandStack.execute(yourCommand);



--
Rob Grzywinski
Re: How to add figures programmatically [message #162470 is a reply to message #162463] Wed, 22 December 2004 01:29 Go to previous messageGo to next message
Christian Hauser is currently offline Christian HauserFriend
Messages: 189
Registered: July 2009
Senior Member
> One nice thing about Eclipse is that you can follow the call path into the
> GEF source if you need to. Following the call path for
> EditPart.getCommand(...) you end up in AbstractTool.executeCurrentCommand()
> which points you to the CommandStack which is retrieved from the EditDomain.
> So at the end of the day you just need to:
>
> commandStack.execute(yourCommand);

Thanks Rob. That seems to work, however, I don't know whether this is a
good solution.

But thanks anyway.

Christian
Re: How to add figures programmatically [message #162486 is a reply to message #162463] Wed, 22 December 2004 02:19 Go to previous message
cloudor Mising name is currently offline cloudor Mising nameFriend
Messages: 34
Registered: July 2009
Member
Hi,

Why not just create the command programmatically because there is no
tools invoked by user activity? Maybe it is better to bother less objects.

Rob Grzywinski wrote:
>>I'd like to programmatically add figures to the diagram using the commands
>>that GEF uses.
>>
>>How can I add an AbstractGraphicalEditPart to the diagram without using
>>the palette to manually add an edit part. I'd like to use the same
>>commands (extending org.eclipse.gef.commands.Command) that would be
>>returned from the various methods of XYLayoutEditPolicy.
>
>
> One nice thing about Eclipse is that you can follow the call path into the
> GEF source if you need to. Following the call path for
> EditPart.getCommand(...) you end up in AbstractTool.executeCurrentCommand()
> which points you to the CommandStack which is retrieved from the EditDomain.
> So at the end of the day you just need to:
>
> commandStack.execute(yourCommand);
>
>
>
> --
> Rob Grzywinski
>
>
Previous Topic:PropertyView driven from selections in Editor
Next Topic:About creating an Image
Goto Forum:
  


Current Time: Fri Apr 26 16:48:10 GMT 2024

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

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

Back to the top