Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » selection and creation commands
selection and creation commands [message #202453] Wed, 09 November 2005 20:51 Go to next message
Eric Wasserman is currently offline Eric WassermanFriend
Messages: 10
Registered: July 2009
Junior Member
Hi all,

I have a GEF style question. I have a GEF editor that allows the user to
create and delete new model objects (and therefore the associated edit
parts). This creation process is may be the result of an action bound to a
key command or what have you. My editor uses only a SelectionTool. I'm not
using a palette for

When a new model object is created I want the associated edit part to become
the only selected editpart. Similarly when undo'ing the delete of an edit
part I want the restored edit part to be selected.

This is all quite doable but as a result I find myself having to pass the
EditPartViewer to the commands so the selection can be manipulated in the
commands' execute and undo methods. This seems like a nasty pollution of the
commands which heretofore had been quite pure in that they knew only of
model objects. Is there a better way to handle this?
Re: selection and creation commands [message #202461 is a reply to message #202453] Wed, 09 November 2005 21:23 Go to previous message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
I haven't tried it out, but I would try to select the newly created EditPart
within one of its methods that only gets called when it is freshly created.
AbstractGraphicalEditPart.createFigure() or EditPart#activate() comes to
mind. Naturally you would also have to somehow distinguish between the
opening of your diagram and the addition of a new object.

"Eric Wasserman" <ewasserman@voxify.com> wrote in message
news:BF97A160.14481%ewasserman@voxify.com...
> Hi all,
>
> I have a GEF style question. I have a GEF editor that allows the user to
> create and delete new model objects (and therefore the associated edit
> parts). This creation process is may be the result of an action bound to a
> key command or what have you. My editor uses only a SelectionTool. I'm not
> using a palette for
>
> When a new model object is created I want the associated edit part to
> become
> the only selected editpart. Similarly when undo'ing the delete of an edit
> part I want the restored edit part to be selected.
>
> This is all quite doable but as a result I find myself having to pass the
> EditPartViewer to the commands so the selection can be manipulated in the
> commands' execute and undo methods. This seems like a nasty pollution of
> the
> commands which heretofore had been quite pure in that they knew only of
> model objects. Is there a better way to handle this?
>
>
Previous Topic:XOR-Bug (and Mac and solution)
Next Topic:Drag And Drop from View to Editor
Goto Forum:
  


Current Time: Tue Nov 12 20:14:40 GMT 2024

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

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

Back to the top