Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Automatically creating additional shapes on a drop from the pallete
Automatically creating additional shapes on a drop from the pallete [message #235244] Thu, 07 June 2007 13:38 Go to next message
Eclipse UserFriend
Originally posted by: jfolap.gmail.com

Hello,

I am experimenting with the Shape Diagram editor in an effort to prototype
some concepts I am considering for an application which I need to write and
become familiar with GEF. One of the concepts is that an item on the
palette would create several items on the canvas. Example: I drag an
Ellipse onto the palette and a triangle is created in addition to the
ellipse.

I know I can simply redefine the EllipseShape to be an IFigure that draws
both an ellipse and triangle, but I want both figures to be model elements
and managed by controllers so they are individually selectable.

I am a bit unclear on how to implement this. My first attempt was to have
the ShapeEditPart create another ShapeEditPart for the triangle (I created a
new TriangleShape) when creating the ellipse. For example I modified
ShapeEditPart.createFigureForModel() to create a ShapeEditPart to control
the triangle. However I am not having much success.

My other guess is that I need to use a customized CreationFactory when
creating the CombinedTemplateCreationEntry on the palette for the ellipse.
However it seems that the CreationFactory (as should be expected) only
returns a single object.

I am sure I am missing some basic insight into the framework and would
appreciate any clues.

Thank you
Re: Automatically creating additional shapes on a drop from the pallete [message #235283 is a reply to message #235244] Fri, 08 June 2007 01:40 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

You can try to tweak your creation factory be creating a list of new
objects (list of model elements) to create. This list will be passed to
the CreateRequest and then you'll have to handle this request correctly to
create a list of commands that will create new elements.
Hope this helps.

Cheers,
Alex
Previous Topic:How to use GEF in RCP.
Next Topic:Zoom working strange with text
Goto Forum:
  


Current Time: Mon Aug 08 23:03:47 GMT 2022

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

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

Back to the top