Add support to declare variable in loop
Currently, it is not possible to use a declared variable from a loop constraint (since it is just text). This prevents from using it inside the loop to either pass it or call methods on it.
We do not want to add a complete language for statements or constraints. Support for this should be added the following way (partly discussed in our meeting on Feb 12th):
- tap-and-hold on the constraint will allow the user to declare a variable (based on the textual constraint provided)
- the user then can select a type
- after, each identifier from the constraint is presented and the user selects the corresponding identifier (e.g., for
Observer o : observers
the user selects o) - optional: the fact that a variable is declared can be shown by, for example, underlining the constraint (since underlining a single word in the text is currently not possible)
- the user should be allowed to remove a declaration or replace it
- potentially it should be possible to declare more than one variable
Comments (8)
-
reporter -
reporter References
#269: Adds createTemporaryProperty to controller.Changes the test for reference creation to test this method to maintain coverage. Moves out creation of temporary property into static method, which is now used by the MessageController as well.
→ <<cset 87e0ad64b70b>>
-
reporter References
#269: Moves making name unique to createTemporaryProperty to ensure consistency.Moves it out of MessageController. Renames public method to createAndAddTemporaryProperty.
→ <<cset 13d3eb775a19>>
-
reporter - changed status to resolved
Resolves
#269: Adds option to define temporary variable to constraint.User first gets asked to choose a name, which is a choice taken from all potential identifiers from the constraint. Then, all possible types are presented before creating the property.
→ <<cset 9839e4f49443>>
-
reporter References
#269: Adds createTemporaryProperty to controller.Changes the test for reference creation to test this method to maintain coverage. Moves out creation of temporary property into static method, which is now used by the MessageController as well.
→ <<cset 87e0ad64b70b>>
-
reporter References
#269: Moves making name unique to createTemporaryProperty to ensure consistency.Moves it out of MessageController. Renames public method to createAndAddTemporaryProperty.
→ <<cset 13d3eb775a19>>
-
reporter Resolves
#269: Adds option to define temporary variable to constraint.User first gets asked to choose a name, which is a choice taken from all potential identifiers from the constraint. Then, all possible types are presented before creating the property.
→ <<cset 9839e4f49443>>
-
reporter Merged in Issues/269-402-Temporary-References (pull request #91)
- Log in to comment
I think it is better to first select the variable name and then the type, since that the former is already there. Although choosing the type and then the variable is more like the "implementing way".