Add ability for assigning values to properties in message views
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)
-
reporter -
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>>
-
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>>
-
reporter References
#266: Adds support for AssignmentStatements to the weaver. The reference to "assignTo" is updated in case it was woven.→ <<cset 64a46bd37e89>>
-
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>>
-
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>>
-
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>>
-
reporter - changed status to resolved
Merged in Issue/156-MessageView-Practicability (pull request #14)
-
reporter Issue
#229was marked as a duplicate of this issue. -
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>>
- Log in to comment
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>>