Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to add Shapes inside Shapes?
How to add Shapes inside Shapes? [message #237780] Thu, 09 August 2007 03:10 Go to next message
Eclipse UserFriend
Originally posted by: el01120.mail.ntua.gr

Hello everyone,

I have had this problem for a long time, now it is time to ask for
help.

Could someone explain briefly what changes I need to make to the shapes
example, if I want to be able to add new Shapes inside the Shapes, and
not only to the Diagram?

I have tried (after making the appropriate changes to the model) to
install an additional EditPolicy on a Shape, which can handle adding of
new Shapes, like the ShapesXYLayoutEditPolicy installed on the
DiagramEditPart.

But no luck, when I select the CREATE tool from the
Palette, the cursor becomes a big black 'X' when the mouse is over an
existing Shape. It only becomes normal when it is over the contents
EditPart.

Actually I use the same EditPolicy on both DiagramEditPart
and ShapeEditPart, and I know it works on the DiagramEditPart because I
can add Shapes to it. I have also added at ShapeEditPart.java:

public void propertyChange(PropertyChangeEvent evt) {
...
if (Shape.CHILD_ADDED_PROP.equals(prop))
addChild(createChild(evt.getNewValue()),-1);
}

Debugging is difficult because ShapeCreateCommand
seems to be called as it should, but then the debugger takes me into a
whole bunch of GEF classes, which I don't know much about and I can't
find what is wrong.

I would be very grateful if someone helps me.
Re: How to add Shapes inside Shapes? [message #237784 is a reply to message #237780] Thu, 09 August 2007 07:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Hi,

If I'm not wrong you have to create a second policy for the role
component and you define in this policy your rules to accept or not a child

Hope this help

Regards

Alexandre
Re: How to add Shapes inside Shapes? [message #237834 is a reply to message #237784] Fri, 10 August 2007 15:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mgauthier.trisotech.com

Hello,

Your figure part needs to install a layout policy
(EditPolicy.LAYOUT_ROLE), such as XYLayoutPolicy that you extend to
implement methods createAddCommand (that is called when an existing object
is drag over your FigurePart) and getCreateCommand (that is called when
you add a new object from the palette) to return the appropriate command
that will add your new shape.

The forbidden sign is displayed whenever no suitable command can be found
in the part and its policies.

Good luck

Melanie
Re: How to add Shapes inside Shapes? [message #237893 is a reply to message #237834] Mon, 13 August 2007 23:28 Go to previous message
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
I did all that, and it still fails -- see my thread "trying to get DND/
Composition to work in GEF ..."

Paul
Previous Topic:trying to get DND/ Composition to work in GEF ...
Next Topic:Adding control in an editor
Goto Forum:
  


Current Time: Fri Apr 26 15:39:33 GMT 2024

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

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

Back to the top