@Override
  protected Command getCreateCommand(CreateRequest request) {
    if (request instanceof CreateViewAndElementRequest) {

      CreateViewAndElementRequest req = (CreateViewAndElementRequest) request;

      if (req.getViewAndElementDescriptor()
              .getSemanticHint()
              .equals(((IHintedType) UMLElementTypes.Pseudostate_16000).getSemanticHint())
          || req.getViewAndElementDescriptor()
              .getSemanticHint()
              .equals(((IHintedType) UMLElementTypes.Pseudostate_17000).getSemanticHint())
          || req.getViewAndElementDescriptor()
              .getSemanticHint()
              .equals(
                  ((IHintedType) UMLElementTypes.ConnectionPointReference_18000)
                      .getSemanticHint())) {

        TransactionalEditingDomain editingDomain =
            ((IGraphicalEditPart) getHost()).getEditingDomain();

        CompositeTransactionalCommand cc =
            new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
        Iterator<?> iter = req.getViewDescriptors().iterator();

        // Retrieve parent location
        Point parentLoc = getHostFigure().getBounds().getLocation().getCopy();

        // Compute relative creation location
        Point requestedLocation = request.getLocation().getCopy();
        getHostFigure().translateToRelative(requestedLocation);

        // Create proposed creation bounds and use the locator to find the expected position
        CustomEntryExitPointPositionLocator locator =
            new CustomEntryExitPointPositionLocator(getHostFigure(), PositionConstants.NONE);
        Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
        Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);

        // Convert the calculated preferred bounds as relative to parent location
        Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());

        while (iter.hasNext()) {

          CreateViewRequest.ViewDescriptor viewDescriptor =
              (CreateViewRequest.ViewDescriptor) iter.next();
          cc.compose(
              new SetBoundsCommand(
                  editingDomain,
                  DiagramUIMessages.SetLocationCommand_Label_Resize,
                  viewDescriptor,
                  creationBounds));
        }

        if (cc.reduce() == null) {
          return null;
        }

        return new ICommandProxy(cc.reduce());
      }
    }
    return null;
  }
  /**
   * Returns the compound command for converting the node type.
   *
   * @return the command.
   */
  public CompoundCommand createCommand() {
    Argument currentArgument = (Argument) currentDiagram.getElement();
    if (currentArgument == null) {
      return null;
    }

    Set<String> excludeIdSet = DcaseEditorUtil.getChildUUIDs(currentArgumentEditPart);

    CompoundCommand cc = new CompoundCommand(CONVERT_NODE_TYPE_CMD_LABEL);

    PreferencesHint diagramPrefHint = currentArgumentEditPart.getDiagramPreferencesHint();

    // shows children.
    NodeChildrenShowHandler showHandler = new NodeChildrenShowHandler();
    ChangeVisibleEditPartsCommand changeVisibleEditPartsCommand =
        new ChangeVisibleEditPartsCommand(
            CONST_CHANGE_VISIBLE_COMMAND_LABEL,
            showHandler.getChildrenToShow((ShapeNodeEditPart) currentEditPart),
            true);
    cc.add(new ICommandProxy(changeVisibleEditPartsCommand));

    IElementType elementType = getElementType(newNodeType);

    ViewAndElementDescriptor descriptor =
        new ViewAndElementDescriptor(
            new CreateElementRequestAdapter(new CreateElementRequest(elementType)),
            Node.class,
            ((IHintedType) elementType).getSemanticHint(),
            diagramPrefHint);

    CreateViewAndElementRequest createNodeRequest = new CreateViewAndElementRequest(descriptor);
    createNodeRequest.setLocation(getNewNodeAbsoluteLocation(currentEditPart));
    createNodeRequest.setSize(new Dimension(-1, -1));
    Command createNodeCommand = currentArgumentEditPart.getCommand(createNodeRequest);
    cc.add(createNodeCommand);

    UpdateLinkCommand convertLinkCommand =
        new UpdateLinkCommand(
            currentDomain,
            UPDATE_BASICLINK_COMMAND_LABEL,
            currentArgument,
            oldNode,
            currentArgumentEditPart,
            createNodeRequest);
    cc.add(new ICommandProxy(convertLinkCommand));

    CopyNodeAttributeCommand copyAttributeCommand =
        new CopyNodeAttributeCommand(
            currentDomain,
            COPY_NODE_ATTRIBUTE_COMMAND_LABEL,
            oldNode,
            currentArgumentEditPart,
            createNodeRequest,
            newName);
    cc.add(new ICommandProxy(copyAttributeCommand));

    ICommand selectCommand =
        new SelectExcludesCommand(SELECT_COMMAND_LABEL, currentArgumentEditPart, excludeIdSet);
    cc.add(new ICommandProxy(selectCommand));
    return cc;
  }