Deleting message broken

Issue #438 resolved
Matthias Schoettle created an issue

As first pointed out in pull request #76 (see comment), the deleting of messages is somewhat broken.

Consider the following example:

Screen Shot 2016-03-28 at 15.39.35.png

When deleting the message betterName := betterName() from target, the following two errors occur:

  • the assignment statement inside the combined fragment is not deleted properly (i.e., it is deleted, because it's container is removed, however, it is still referenced by the lifeline)
  • the message inside the combined fragment is not removed from the interaction

This shows that the way of how messages are removed is not ideal. Currently, all fragments are collected between the first and last found index, however, messages inside combined fragments are not dealt with specifically. Also, fragments inside combined fragments are not handled specifically.

I propose to use the createRemoveInteractionFragmentCommand of FragmentsController, which already takes care of all the different fragments, and messages inside combined fragments.

Comments (11)

  1. Matthias Schoettle reporter

    References #438: Refactors test cases for message removal.

    Adds specific model for message removal tests. Adds additional test case for assignment statement.

    → <<cset 13fe29a66358>>

  2. Matthias Schoettle reporter

    References #438 and #194: Adds more test cases for nested behaviour.

    Also, for #194, a specific test case is added (testRemoveMessages_NestedNestedBehaviour), which fails right now.

    → <<cset 8f664f61f16c>>

  3. Matthias Schoettle reporter

    References #438 and #194: Adds another test case for nested nested behaviour.

    This test cases checks the second case of getting the toIndex, where no other fragment is on the outgoing lifeline, which causes only the one message being removed.

    → <<cset 5edfe37d93f6>>

  4. Matthias Schoettle reporter

    References #304, #438, #194: Improves removal of fragments and messages.

    All removal is now performed by the FragmentsController, i.e., the MessageViewController delegates this task to it now.

    Removal is improved significantly in that: - all to be deleted fragments are determined - all affected messages are deleted - unused properties are removed - unused combined fragments are removed from lifelines (when no other fragment within a combined fragment covers a lifeline) - unused lifelines are removed

    The end of the message behaviour (for nested behaviour) is properly detected. Nested behaviour needs to be terminated with a reply message. However, it still works in the case that another fragment is placed on the same originating lifeline.

    → <<cset 569a78a97a89>>

  5. Matthias Schoettle reporter

    References #304, #438, #194: Fixes test cases and models to address changes introduced.

    Create message with nested behaviour now have a reply message. When removing a combined fragment or operand, the fragments are not specifically removed, but are removed by removing the container (operand).

    → <<cset 0dadc71a6aea>>

  6. Matthias Schoettle reporter

    References #304, #438, #194: Fixes order of fragment removal commands to prevent problem when undoing.

    The call to isSelfMessage caused an OCL exception because the coveredBy of the send event was not set yet. Therefore the coveredBy is removed separately after all fragments are removed, so that this is already set when undoing it.

    Small refactoring in MessageViewController to pass the message instead of the end, to ensure that the send event is passed to removeInteractionFragment.

    → <<cset f8ccee565d88>>

  7. Log in to comment