/**
   * Returns a composite command with the given initial command and the RegionContainer specific
   * auto-size commands to propagate the auto-size to the regions.
   *
   * @param request the initial request
   * @param autoSizeCommand the initial command
   * @return a composite command with the initial command and the region container specific
   *     additional commands.
   */
  protected Command getRegionContainerAutoSizeCommand(Request request, Command autoSizeCommand) {
    IDiagramElementEditPart host = (IDiagramElementEditPart) getHost();
    TransactionalEditingDomain domain = host.getEditingDomain();
    CompositeTransactionalCommand ctc =
        new CompositeTransactionalCommand(
            domain,
            Messages.RegionContainerResizableEditPolicy_regionContainerAutoSizeCommandLabel);
    ctc.add(new CommandProxy(autoSizeCommand));
    Command regionContainerAutoSizeCommand = new ICommandProxy(ctc);

    // Propagate the auto-size request to the regions.
    Request req = new Request();
    req.setType(request.getType());
    req.getExtendedData().put(REGION_AUTO_SIZE_PROPAGATOR, host);

    Object object = request.getExtendedData().get(REGION_AUTO_SIZE_PROPAGATOR);
    for (EditPart regionPart : getRegionParts()) {
      if (object != regionPart) {
        ctc.add(new CommandProxy(regionPart.getCommand(req)));
      }
    }

    ctc.add(
        CommandFactory.createICommand(
            domain, new RegionContainerUpdateLayoutOperation((Node) host.getModel())));
    return regionContainerAutoSizeCommand;
  }
 private boolean concernRegionContainer() {
   boolean regionImpacted = false;
   EditPart hostPart = getHost();
   if (hostPart instanceof AbstractDiagramElementContainerEditPart) {
     IDiagramElementEditPart ideep = (IDiagramElementEditPart) hostPart;
     DDiagramElement dde = ideep.resolveDiagramElement();
     regionImpacted =
         dde instanceof DNodeContainer
             && new DNodeContainerExperimentalQuery((DNodeContainer) dde).isRegionContainer();
   }
   return regionImpacted;
 }
 private int getStackDirection() {
   int direction = PositionConstants.NONE;
   EditPart hostPart = getHost();
   if (hostPart instanceof AbstractDiagramElementContainerEditPart) {
     IDiagramElementEditPart ideep = (IDiagramElementEditPart) hostPart;
     DDiagramElement dde = ideep.resolveDiagramElement();
     if (dde instanceof DNodeContainer) {
       DNodeContainerExperimentalQuery query =
           new DNodeContainerExperimentalQuery((DNodeContainer) dde);
       if (query.isVerticalStackContainer()) {
         direction = PositionConstants.NORTH_SOUTH;
       } else if (query.isHorizontaltackContainer()) {
         direction = PositionConstants.EAST_WEST;
       }
     }
   }
   return direction;
 }