Package org.eclipse.gef.examples.logicdesigner.model.commands

Examples of org.eclipse.gef.examples.logicdesigner.model.commands.CloneCommand


* returned.
* @param request the Clone Request
* @return A command to perform the Clone.
*/
protected Command getCloneCommand(ChangeBoundsRequest request) {
  CloneCommand clone = new CloneCommand();
  clone.setParent((LogicDiagram)getHost().getModel());
 
  EditPart after = getInsertionReference(request);
  int index = getHost().getChildren().indexOf(after);
 
  Iterator i = request.getEditParts().iterator();
  GraphicalEditPart currPart = null;
 
  while (i.hasNext()) {
    currPart = (GraphicalEditPart)i.next();
    clone.addPart((LogicSubpart)currPart.getModel(), index++);
  }
 
  return clone;
}
View Full Code Here


* returned.
* @param request the Clone Request
* @return A command to perform the Clone.
*/
protected Command getCloneCommand(ChangeBoundsRequest request) {
  CloneCommand clone = new CloneCommand();
 
  clone.setParent((LogicDiagram)getHost().getModel());
 
  Iterator i = request.getEditParts().iterator();
  GraphicalEditPart currPart = null;
 
  while (i.hasNext()) {
    currPart = (GraphicalEditPart)i.next();
    clone.addPart((LogicSubpart)currPart.getModel(),
        (Rectangle)getConstraintForClone(currPart, request));
  }
 
  // Attach to horizontal guide, if one is given
  Integer guidePos = (Integer)request.getExtendedData()
      .get(SnapToGuides.KEY_HORIZONTAL_GUIDE);
  if (guidePos != null) {
    int hAlignment = ((Integer)request.getExtendedData()
        .get(SnapToGuides.KEY_HORIZONTAL_ANCHOR)).intValue();
    clone.setGuide(findGuideAt(guidePos.intValue(), true), hAlignment, true);
  }
 
  // Attach to vertical guide, if one is given
  guidePos = (Integer)request.getExtendedData()
      .get(SnapToGuides.KEY_VERTICAL_GUIDE);
  if (guidePos != null) {
    int vAlignment = ((Integer)request.getExtendedData()
        .get(SnapToGuides.KEY_VERTICAL_ANCHOR)).intValue();
    clone.setGuide(findGuideAt(guidePos.intValue(), false), vAlignment, false);
  }

  return clone;
}
View Full Code Here

TOP

Related Classes of org.eclipse.gef.examples.logicdesigner.model.commands.CloneCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.