Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to draw add figure without pallette
How to draw add figure without pallette [message #146055] Mon, 02 August 2004 20:30 Go to next message
Eclipse UserFriend
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 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
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
>
>
>
>
>
Previous Topic:Is there any example on showing two graph in one editor?
Next Topic:Doc GEF 3.0
Goto Forum:
  


Current Time: Fri Apr 19 08:29:16 GMT 2024

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

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

Back to the top