Skip to main content



      Home
Home » Eclipse Projects » GEF » How to add figures programmatically
How to add figures programmatically [message #162448] Tue, 21 December 2004 18:38 Go to next message
Eclipse UserFriend
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] Tue, 21 December 2004 19:10 Go to previous messageGo to next message
Eclipse UserFriend
> 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] Tue, 21 December 2004 20:29 Go to previous messageGo to next message
Eclipse UserFriend
> 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] Tue, 21 December 2004 21:19 Go to previous message
Eclipse UserFriend
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 Jul 18 07:06:43 EDT 2025

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

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

Back to the top