How to replace object in ordered collection? [message #1802002] |
Wed, 30 January 2019 09:55  |
Eclipse User |
|
|
|
Hi,
Assume that my language contains a CallExpression that owns a collection of arguments, each being represented by an Expression instance.
Assume that I create a property view where each argument is shown in a separate widget (a text widget or something like that).
Then, if the user changes such expression, I need to modify the collection. Typically, I would write a java service that interprets the text and then creates an Expression. That expression should replace the existing one in the 'arguments' collection.
What would be the best way to do that in Sirius? The approach that I've used so far is to navigate to the containing CallExpression. With a let operation, I create a variable that contains the list of current arguments. By using ->remove and ->insertAt on that variable I create the new 'arguments' collection. There I invoke an 'unset' operation that empties the old arguments collection and use a 'set' operation to give it the new collection.
That sounds cumbersome doesn't it? I'm looking for a 'replace' like operation on the arguments attribute of my CallExpression. What would be the preferred way to accomplish something like this?
Greetings,
Wilbert.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04102 seconds