Bidirectional association loses user feature selection

Issue #472 resolved
Matthias Schoettle created an issue

The user selection is lost for the opposite association end in certain cases.

Steps to reproduce:

  • Create Aspect with class A and B
  • Create bidirectional association between classes
  • Change both multiplicities to 1..*
  • Make the first selection (e.g., ArrayList) on class A (myAs)
  • Make the second selection (e.g., ArrayList) on class B (myBs)

Result:

The selection on class A (myAs) disappears. However, the automatic selection is still there. This can be seen in the concern when you show the reuses.

As far as I understand the feature selection for the opposite end is recreated based on the updated feature selection on the other end. However, the existing user feature selection is not kept.

Another problem is that once this works, undoing changes in bidirectional associations makes the selection of the opposite end disappear sometimes.

Comments (6)

  1. Matthias Schoettle reporter

    References #472: Ensures that opposite feature selection is not removed first, but within the BidirectionalCompoundCommand's execute so that the user selection is kept.

    Due to the dirty hack to have a non-empty compound command in setFeatureSelection, the feature selection was deleted, so that it was never retrieved in execute.

    Now, an arbitrary command that changes to the same configuration name is used in order to ensure that an existing user selection is always found and removed in the same location (command's execute method).

    → <<cset 42937dba0c7e>>

  2. Matthias Schoettle reporter
    • changed status to open

    The fix provided for this issue caused the following to not work properly anymore:

    • Create A and B with a bidirectional association between them
    • Change one end to 0..*
    • Save

    The save fails, because the operations for the simple end are not contained in a resource.

    It seems like deleting one feature selection, adding it, then deleting the other and adding it will cause the operations to be first created for the first end, and then removed again before adding new ones. See BidirectionalCompoundCommand.execute.

  3. Matthias Schoettle reporter

    Resolves #472 again: Reverts partial changes from commit 42937db and ensures the reuse configuration with the user selection is copied before it's deleted.

    First deletes both feature selections before creating them. Additionally, the reuse configuration is copied before it is subsequently deleted when deleting the feature selection.

    → <<cset 30ef0562bb03>>

  4. Log in to comment