/**
   * Constructs a new popupmenu. The given parameter role determines what the purpose is of the
   * actions that can be created via this popupmenu. The parameter must comply to the interface
   * Roles defined on ActionNewAction.
   *
   * @param role the role
   * @param list the list
   */
  public PopupMenuNewAction(String role, UMLMutableLinkedList list) {
    super();

    JMenu newMenu = new JMenu();
    newMenu.setText(Translator.localize("action.new"));
    newMenu.add(ActionNewCallAction.getInstance());
    ActionNewCallAction.getInstance().setTarget(list.getTarget());
    ActionNewCallAction.getInstance().putValue(ActionNewAction.ROLE, role);
    newMenu.add(ActionNewCreateAction.getInstance());
    ActionNewCreateAction.getInstance().setTarget(list.getTarget());
    ActionNewCreateAction.getInstance().putValue(ActionNewAction.ROLE, role);
    newMenu.add(ActionNewDestroyAction.getiNSTANCE());
    ActionNewDestroyAction.getiNSTANCE().setTarget(list.getTarget());
    ActionNewDestroyAction.getiNSTANCE().putValue(ActionNewAction.ROLE, role);
    newMenu.add(ActionNewReturnAction.getInstance());
    ActionNewReturnAction.getInstance().setTarget(list.getTarget());
    ActionNewReturnAction.getInstance().putValue(ActionNewAction.ROLE, role);
    newMenu.add(ActionNewSendAction.getInstance());
    ActionNewSendAction.getInstance().setTarget(list.getTarget());
    ActionNewSendAction.getInstance().putValue(ActionNewAction.ROLE, role);
    newMenu.add(ActionNewTerminateAction.getInstance());
    ActionNewTerminateAction.getInstance().setTarget(list.getTarget());
    ActionNewTerminateAction.getInstance().putValue(ActionNewAction.ROLE, role);
    newMenu.add(ActionNewUninterpretedAction.getInstance());
    ActionNewUninterpretedAction.getInstance().setTarget(list.getTarget());
    ActionNewUninterpretedAction.getInstance().putValue(ActionNewAction.ROLE, role);
    add(newMenu);

    addSeparator();

    ActionRemoveModelElement.SINGLETON.setObjectToRemove(
        ActionNewAction.getAction(role, list.getTarget()));
    add(ActionRemoveModelElement.SINGLETON);
  }
  /** Construct a property panel for a Comment. */
  public PropPanelComment() {
    super("Comment", ConfigLoader.getTabPropsOrientation());

    addField(Translator.localize("label.name"), getNameTextField());

    UMLMutableLinkedList umll =
        new UMLMutableLinkedList(new UMLCommentAnnotatedElementListModel(), null, null);
    umll.setDeleteAction(new ActionDeleteAnnotatedElement());
    addField(Translator.localize("label.annotated-elements"), new JScrollPane(umll));

    addSeparator();

    UMLTextArea2 text = new UMLTextArea2(new UMLCommentBodyDocument());
    text.setLineWrap(true);
    text.setRows(5);
    JScrollPane pane = new JScrollPane(text);
    addField(Translator.localize("label.comment.body"), pane);

    addAction(new ActionNavigateContainerElement());
    addAction(new ActionNewStereotype());
    addAction(getDeleteAction());
  }
  /**
   * Constructor for PopupMenuNewEvent.
   *
   * <p>Constructs a new popupmenu. The given parameter role determines what the purpose is of the
   * events that can be created via this popupmenu. The parameter must comply to the interface Roles
   * defined on ActionNewEvent.
   *
   * @param role the role
   * @param list the list
   */
  public PopupMenuNewEvent(String role, UMLMutableLinkedList list) {
    super();

    assert role != null;

    if (role.equals(ActionNewEvent.Roles.DEFERRABLE_EVENT)
        || role.equals(ActionNewEvent.Roles.TRIGGER)) {
      JMenu select = new JMenu();
      select.setText(Translator.localize("action.select"));
      if (role.equals(ActionNewEvent.Roles.DEFERRABLE_EVENT)) {
        ActionAddEventAsDeferrableEvent.SINGLETON.setTarget(list.getTarget());
        select.add(ActionAddEventAsDeferrableEvent.SINGLETON);
      } else if (role.equals(ActionNewEvent.Roles.TRIGGER)) {
        ActionAddEventAsTrigger.SINGLETON.setTarget(list.getTarget());
        select.add(ActionAddEventAsTrigger.SINGLETON);
      }
      add(select);
    }

    JMenu newMenu = new JMenu();
    newMenu.setText(Translator.localize("action.new"));
    newMenu.add(ActionNewCallEvent.getSingleton());
    ActionNewCallEvent.getSingleton().setTarget(list.getTarget());
    ActionNewCallEvent.getSingleton().putValue(ActionNewEvent.ROLE, role);
    newMenu.add(ActionNewChangeEvent.getSingleton());
    ActionNewChangeEvent.getSingleton().setTarget(list.getTarget());
    ActionNewChangeEvent.getSingleton().putValue(ActionNewEvent.ROLE, role);
    newMenu.add(ActionNewSignalEvent.getSingleton());
    ActionNewSignalEvent.getSingleton().setTarget(list.getTarget());
    ActionNewSignalEvent.getSingleton().putValue(ActionNewEvent.ROLE, role);
    newMenu.add(ActionNewTimeEvent.getSingleton());
    ActionNewTimeEvent.getSingleton().setTarget(list.getTarget());
    ActionNewTimeEvent.getSingleton().putValue(ActionNewEvent.ROLE, role);
    add(newMenu);

    addSeparator();

    ActionRemoveModelElement.SINGLETON.setObjectToRemove(
        ActionNewEvent.getAction(role, list.getTarget()));
    add(ActionRemoveModelElement.SINGLETON);
  }