/**
         * Constructor for PopupMenu.
         */
        public PopupMenu() {
            super();

            JMenu pMenu = new JMenu();
            pMenu.setText(Translator.localize("button.new-pseudostate"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getChoice(),
                    "label.pseudostate.choice"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getInitial(),
                    "label.pseudostate.initial"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getDeepHistory(),
                    "label.pseudostate.deephistory"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getJunction(),
                    "label.pseudostate.junction"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getShallowHistory(),
                    "label.pseudostate.shallowhistory"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getFork(),
                    "label.pseudostate.fork"));
            pMenu.add(new ActionNewPseudoState(
                    Model.getPseudostateKind().getJoin(),
                    "label.pseudostate.join"));

            JMenu newMenu = new JMenu();
            newMenu.setText(Translator.localize("action.new"));
            newMenu.add(pMenu);

            newMenu.add(ActionNewSynchState.getInstance());
            ActionNewSynchState.getInstance().setTarget(getTarget());
            newMenu.add(ActionNewStubState.getInstance());
            ActionNewStubState.getInstance().setTarget(getTarget());
            newMenu.add(ActionNewCompositeState.getSingleton());
            ActionNewCompositeState.getSingleton().setTarget(getTarget());
            newMenu.add(ActionNewSimpleState.getSingleton());
            ActionNewSimpleState.getSingleton().setTarget(getTarget());
            newMenu.add(ActionNewFinalState.getSingleton());
            ActionNewFinalState.getSingleton().setTarget(getTarget());
            newMenu.add(ActionNewSubmachineState.getInstance());
            ActionNewSubmachineState.getInstance().setTarget(getTarget());
            add(newMenu);

            addSeparator();

            ActionRemoveModelElement.SINGLETON.setTarget(getSelectedValue());
            ActionRemoveModelElement.SINGLETON.setObjectToRemove(
                    getSelectedValue());
            add(ActionRemoveModelElement.SINGLETON);
        }
예제 #2
0
  /**
   * 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);
  }
예제 #3
0
  /**
   * 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);
  }