Add ability for assigning values to properties in message views

Issue #266 resolved
Matthias Schoettle created an issue

Right now, it is impossible to assign a value to a new or existing property. The only possibility is to use an ExecutionStatement. While this works with existing properties, when defining new properties and assigning a value to them it is impossible to use them later, for example, passing it as a parameter in a message call.

Therefore, we need a new fragment that allows this. The value that is assigned can be just an expression, as otherwise we would need compilation capabilities or similar to make sure it is correct.

Maybe related is the problem of declaring variables in loops and catch operands, however, the same solution might not be applicable.

Comments (10)

  1. Matthias Schoettle reporter

    References #266: Adds a new fragment "AssignmentStatement" to the message view metamodel, which has an assignTo reference and contains a ValueSpecification. By default, just like the interaction constraints, the OpaqueExpression will be used, but it is generally possible to support others (especially literal ones) as well.

    → <<cset 697aad869495>>

  2. Matthias Schoettle reporter

    References #266: Adds a view for AssignmentStatements and the ability to create and modify them.

    When the "assignTo" is changed and the existing one is a temporary property, only in case it is not referenced by another message in its "assignTo" it is deleted (it is then considered as not used anymore since it was defined there).

    The AssignToHandler is reused to be able to set the value. However, because the functionality of this and Message.assignTo is slightly different when handling the result of creating a temporary property or assigning a new (existing value), AssignToHandler is abstract and will pass the responsibility to handle those two events to the sub-class (i.e., MessageAssignToHandler and AssignmentAssignToHandler).

    → <<cset ff987f5049a6>>

  3. Matthias Schoettle reporter

    References #266: Adds the ability to generate code for assignment statement. For non-local properties, always "this." is added before to support setter statements such as "attribute = attribute".

    → <<cset 24d75e234010>>

  4. Matthias Schoettle reporter

    References #266: Adds the addition of assignment statements to the message view when an existing message view is loaded and built initially.

    → <<cset 985637cacbc5>>

  5. Matthias Schoettle reporter

    References #266: Adds the proper usage of SelectorView to provide a valid selection for temporary variable types. For this, the item provider is used.

    → <<cset ad52cc8dbb5a>>

  6. Matthias Schoettle reporter

    References #266: Adds a type text view for the type of the assignTo reference.

    The text view directly displays the referenced type's name, which means that it can be null. Therefore, this commit also adds support for this (including unregister/register to data) in the TextView.

    → <<cset 023c231f801a>>

  7. Matthias Schoettle reporter

    References #266: Adds a reference update of a fragment (from an advice) after it was woven into the message view. This is especially required for AssignmentStatements that can reference local properties, which are copied over during the fragment update.

    → <<cset 7a76dac77e40>>

  8. Log in to comment