How to draw add figure without pallette [message #146055] |
Mon, 02 August 2004 20:30 |
Eclipse User |
|
|
|
Originally posted by: turker.keskinpala.vanderbilt.edu
Hi all,
I am trying to draw a rectange on a current model. This would basically be
adding a child to the existing model just like you can do using the palette.
But I would like to do that within my program without using the pallette.
As far as I understood, First, I should generate a CreateRequest and set its
factory to the model of the part I want to draw. Then, I should get the
current model diagram and the EditPartFactory registered with the graphical
editor to be able to call its createEditPart method with that model diagram
and proceed somehow from there. I am not sure if this is the correct way (is
it???), but my problem is that I cannot get the instance of the graphical
editor to get the model diagram and the editpartfactory. How can I do that,
if all that is at all possible?
I hope this was clear. Any help, suggestions, and pointers will be greatly
appreciated.
Thanks for your time,
Turker Keskinpala
|
|
|
Re: How to draw add figure without pallette [message #146786 is a reply to message #146055] |
Fri, 06 August 2004 18:52 |
Pratik Shah Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
If you don't have the palette, how is the user going to switch to this mode
of adding something?
"Turker Keskinpala" <turker.keskinpala@vanderbilt.edu> wrote in message
news:cem857$qlr$1@eclipse.org...
> Hi all,
>
> I am trying to draw a rectange on a current model. This would basically be
> adding a child to the existing model just like you can do using the
palette.
> But I would like to do that within my program without using the pallette.
>
> As far as I understood, First, I should generate a CreateRequest and set
its
> factory to the model of the part I want to draw. Then, I should get the
> current model diagram and the EditPartFactory registered with the
graphical
> editor to be able to call its createEditPart method with that model
diagram
> and proceed somehow from there.
You don't need to do create the EditPart yourself. Once you generate a
CreateRequest you ask the targeted EditPart for the CreateCommand. All you
then have to do is execute that command which will add the new model part to
the actual model hierarchy. The parent model should notify its
corresponding EditPart about the new child added, and that EditPart should
invoke refreshChildren(). The GEF setup will then create an EditPart for
that model object (via the EditPartFactory) and add it to the diagram.
> I am not sure if this is the correct way (is
> it???), but my problem is that I cannot get the instance of the graphical
> editor to get the model diagram and the editpartfactory. How can I do
that,
> if all that is at all possible?
>
> I hope this was clear. Any help, suggestions, and pointers will be greatly
> appreciated.
>
> Thanks for your time,
> Turker Keskinpala
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05549 seconds