Add CreateDevice action to context menu [message #249317] |
Wed, 17 June 2009 05:01  |
Eclipse User |
|
|
|
Hi,
As you can see in the title, I would like to add a customized action to my
context menu. Actually I would be able to insert a node on a Connection
via the context menu on the selected Connection. It means :
1) to create a node
2) to reconnect the selected Connection with the created node
3) to create a new Connection between the created node and the last node
if 'O' is an old Node, 'N' the new Node to insert and '-' a Connection, I
could draw the situation like this :
0) O-O
1) O-O N
2) O-N O
3) O-N-O
Could you give me information or some help to create such actions ?
Thanks
Matthieu
|
|
|
|
|
Re: Add CreateDevice action to context menu [message #249478 is a reply to message #249430] |
Thu, 02 July 2009 21:04  |
Eclipse User |
|
|
|
If it's one action from the user's perspective, then you should have a
single Command that implements all the necessary steps and has logic to
redo() them or undo() them in one shot.
HTH
Ben
Matthieu wrote:
> Hi,
>
> Ben Vitale wrote:
>
>> Regarding the action itself, you can subclass
>> org.eclipse.gef.ui.actions.SelectionAction so you can get a handle to
>> the connection that provides the starting context.
>> Hope that helps
>
> Thank you for the information, now it works properly but I still a
> question about this set of Actions.
>
> For the moment I have separate the Node creation from Connection
> creations because I guess that if I try to use a CompoundCommand to put
> them together in it I'll be in trouble to get the needed EditPart for
> Connections whereas it has not already been created. I mean when I use
> run() method I get Node creation command which is executed and then I
> create and execute Connection commands.
>
> Anyway how can I gather the result of 3 actions in the same undo()
> method ? Indeed I need only one redo() to perform the 3 actions but I
> need 3 undo() calls to go back.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03991 seconds