/**
   * isFirtLifelineNodeFromFragment
   *
   * @param fragmentNode
   * @return boolean
   */
  private boolean isFirtLifelineNodeFromFragment(NotationNode fragmentNode) {
    List<LifeLineNode> list = new ArrayList<LifeLineNode>();
    List<AbstractNode> nodeList = diagram.getNodeList();

    CombinedFragment combindFragment = (CombinedFragment) fragmentNode.getUmlModel();
    EList<Lifeline> coveredsLifeline = combindFragment.getCovereds();
    for (Lifeline lifeline : coveredsLifeline) {
      for (AbstractNode abstractNode : nodeList) {
        if (abstractNode instanceof LifeLineNode && lifeline.equals(abstractNode.getUmlModel())) {
          if (list.size() == 0) {
            list.add((LifeLineNode) abstractNode);
          } else {
            if (list.get(0).getX() > abstractNode.getX()) {
              list.add(0, (LifeLineNode) abstractNode);
            } else {
              list.add((LifeLineNode) abstractNode);
            }
          }
        }
      }
    }

    if (node.equals(list.get(0))) {
      return true;
    }

    return false;
  }
  /**
   * isMoveFragment
   *
   * @param fragmentNode
   * @return boolean
   */
  private boolean isMoveFragment(NotationNode fragmentNode) {
    CombinedFragment combindFragment = (CombinedFragment) fragmentNode.getUmlModel();
    if (combindFragment.getCovereds().contains(node.getUmlModel())) {
      if (isFirtLifelineNodeFromFragment(fragmentNode)) {
        return true;
      }
    } else {
      if (fragmentNode.getX() > node.getX()) {
        return true;
      }
    }

    return false;
  }
  /** @see org.eclipse.gef.commands.Command#execute() */
  @Override
  public void execute() {
    node.setX(newX);
    setLifeLineLayout();

    if (diagram != null) {
      SequenceUtil.refreshLifeLineOrder(diagram);
    }
  }
 /**
  * ShiftLifeLineNodeCommand
  *
  * @param editPart
  * @param constraint
  * @param lifeLineNodeList
  * @param diagram
  */
 public ShiftLifeLineNodeCommand(
     EditPart editPart,
     Rectangle constraint,
     List<LifeLineNode> lifeLineNodeList,
     Diagram diagram) {
   this.node = (AbstractNode) editPart.getModel();
   this.lifeLineNodeList = lifeLineNodeList;
   this.oldX = node.getX();
   this.newX = constraint.x;
   this.diagram = diagram;
 }
  /** Undo된 Move의 위치에 따라서 다이어그램 내의 다른 LifeLine의 위치를 조정한다. void */
  private void unSetLifeLineLayout() {

    LifeLineNode lifeLineNode;
    LifeLineNode otherLifeLineNode;

    for (int i = 0; i < lifeLineNodeList.size(); i++) {
      lifeLineNode = (LifeLineNode) lifeLineNodeList.get(i);
      if (node.equals(lifeLineNode)) {
        for (int k = i + 1; k < lifeLineNodeList.size(); k++) {
          otherLifeLineNode = (LifeLineNode) lifeLineNodeList.get(k);
          otherLifeLineNode.setX(otherLifeLineNode.getX() - (newX - oldX));
        }

        break;
      }
    }
  }
  /** Move 되는 위치에 따라서 다이어그램 내의 다른 LifeLine의 위치를 조정한다. void */
  private void setLifeLineLayout() {

    LifeLineNode lifeLineNode;
    LifeLineNode otherLifeLineNode;

    for (int i = 0; i < lifeLineNodeList.size(); i++) {
      lifeLineNode = (LifeLineNode) lifeLineNodeList.get(i);
      if (node.equals(lifeLineNode)) {
        for (int k = i + 1; k < lifeLineNodeList.size(); k++) {
          otherLifeLineNode = (LifeLineNode) lifeLineNodeList.get(k);
          otherLifeLineNode.setX(otherLifeLineNode.getX() + (newX - oldX));
        }
        break;
      }
    }

    layoutCombinedFragment(SequenceUtil.getOnlyCombindFragmentNodeList(diagram.getNodeList()));
  }
 /** @see org.eclipse.gef.commands.Command#redo() */
 @Override
 public void undo() {
   node.setX(oldX);
   unSetLifeLineLayout();
 }
 /** @see org.eclipse.gef.commands.Command#redo() */
 @Override
 public void undo() {
   node.setHeight(oldHeight);
 }
 /** @see org.eclipse.gef.commands.Command#execute() */
 @Override
 public void execute() {
   node.setHeight(newHeight);
 }
 /**
  * ReSizeOnlyHeightLifeLineNodeCommand
  *
  * @param editPart
  * @param height
  */
 public ReSizeOnlyHeightLifeLineNodeCommand(EditPart editPart, int height) {
   this.node = (AbstractNode) editPart.getModel();
   oldHeight = node.getHeight();
   this.newHeight = height;
 }