Example #1
0
  @Override
  public void execute(ICustomContext context) {

    // Re-check if only one element is selected
    PictogramElement[] pes = context.getPictogramElements();
    if (pes != null && pes.length == 1) {
      Object bo = getBusinessObjectForPictogramElement(pes[0]);
      if (bo instanceof Fifo) {
        Fifo fifo = (Fifo) bo;

        // Ask user for data type.
        String question = "Enter data type for the FIFO";
        String oldType = fifo.getType();
        String type = oldType;

        type = PiMMUtil.askString(getName(), question, type, null);
        if ((type == null && oldType == null) || (type != null && type.equals(oldType))) {
          this.hasDoneChanges = false;
        } else {
          this.hasDoneChanges = true;
        }
        fifo.setType(type);

        // Call the layout feature
        layoutPictogramElement(pes[0]);
      }
    }
  }