eclipse gef - gef : change child constraint to a new parent -


i have somme process elements can contain other process elements no limit.

i managed addition of new process other directly palette, works right when drag process drawn integrate new child of process drawn, editor don't let me , have white cross cursor.

in model process class extending containerelement class wich handles addition , removal of children , notification stuff.

i thinking since process have new parent must add in change constraintcommand

here's snippet of code

    public class processfigure extends figure {     public processfigure() {     setlayoutmanager(new xylayout());      ellipse = new ellipse();     ellipse.setfill(false);     add(ellipse);     label = new label();     add(label);     ellipse.setlayoutmanager(new xylayout());    }      public ifigure getcontentpane() {     return ellipse;    }     ... }   ------------------------------  public class processeditpart extends containerelementeditpart {  ...     public ifigure getcontentpane() {     return ((processfigure)getfigure()).getcontentpane();     }      @override     protected void createeditpolicies() {     installeditpolicy(editpolicy.layout_role, new containerelementxylayouteditpolicy(             (xylayout) getcontentpane().getlayoutmanager()));     } ... } ------------------------  public class containerelementxylayouteditpolicy extends xylayouteditpolicy {     ...     public containerelementxylayouteditpolicy(xylayout layoutmanager) {     super();     setxylayout(layoutmanager);     }      private command getprocesscreatecommand(createrequest request) {     processcreatecommand result = new processcreatecommand();     rectangle constraint = (rectangle) getconstraintfor(request);     result.setlocation(constraint.getlocation());     result.setprocess((process)request.getnewobject());     result.setparent((containerelement)gethost().getmodel());     return result;     }       protected command createchangeconstraintcommand (changeboundsrequest request,editpart child , object constraint) {     processchangeconstraintcommand changeconstraintcommand = new processchangeconstraintcommand ();      changeconstraintcommand.setprocess((process)child.getmodel());     changeconstraintcommand.setnewconstraint((rectangle)constraint);     return changeconstraintcommand;      }     ...  } 

i think problem gef can't figure appropriate layout manager, tried several changes everytime cast or stackoverflow exception, please !

when drag element outside figure of edit part gef fires req_orphan request must handled edit part element taken out. if not done, think can't take element outside edit part's figure. can handle requires overriding getorphanchildrencommand in layouteditpolicy class.

i have never used feature, written in moving , resizing of gef programmer's guide


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -