Add support to declare variable in loop

Issue #269 resolved
Matthias Schoettle created an issue

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)

  1. Matthias Schoettle reporter

    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".

  2. Matthias Schoettle 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>>

  3. Matthias Schoettle reporter

    References #269: Moves making name unique to createTemporaryProperty to ensure consistency.

    Moves it out of MessageController. Renames public method to createAndAddTemporaryProperty.

    refs #407 refs #402

    → <<cset 13d3eb775a19>>

  4. Matthias Schoettle 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>>

  5. Matthias Schoettle 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>>

  6. Matthias Schoettle reporter

    References #269: Moves making name unique to createTemporaryProperty to ensure consistency.

    Moves it out of MessageController. Renames public method to createAndAddTemporaryProperty.

    refs #407 refs #402

    → <<cset 13d3eb775a19>>

  7. Matthias Schoettle 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>>

  8. Log in to comment