Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Help Moving Shapes(How can i move a shape inside another)
Help Moving Shapes [message #1111587] Wed, 18 September 2013 12:25 Go to next message
Victor Lopez is currently offline Victor LopezFriend
Messages: 21
Registered: August 2013
Junior Member
Hello everybody,

I am pretty new to this framework. I have done the tutorial and ok, i know more or less how does it works. But now that i want to do some more i dont know how to.

I wanted to move one shape into another (like drop one rectange and then drop anotherone inside of it) and it is not explained in the tutorial and I could not find other clear things on the internet. i would really appreciate your help.

package org.eclipse.graphiti.examples.tutorial.features;
public class TutorialMoveEClassFeature extends DefaultMoveShapeFeature {
    public TutorialMoveEClassFeature(IFeatureProvider fp) {
    public boolean canMoveShape(IMoveShapeContext context) {
        boolean canMove = super.canMoveShape(context);
        // perform further check only if move allowed by default feature
        if (canMove) {
            // don't allow move if the class name has the length of 1
            Shape shape = context.getShape();
            Object bo = getBusinessObjectForPictogramElement(shape);
            if (bo instanceof EClass) {
                EClass c = (EClass) bo;
                if (c.getName() != null && c.getName().length() == 1) {
                    canMove = false;
        return canMove;

This is what I gor from tutorial just in case someone wants to write something in the middle.

Thank you in advance,

Re: Help Moving Shapes [message #1113010 is a reply to message #1111587] Fri, 20 September 2013 14:09 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1927
Registered: July 2009
Location: Walldorf, Germany
Senior Member

basically the super class DefaultMoveShapeFeature does what you need (see
internalMove()). The trick is simply to change the parent of the moved

Previous Topic:Undo a feature
Next Topic:Diagram background with gradient colors
Goto Forum:

Current Time: Sun Jun 20 03:49:04 GMT 2021

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

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

Back to the top