Removing an enumeration from a collection [message #1819578] |
Fri, 17 January 2020 09:09  |
Eclipse User |
|
|
|
Hi,
In my language, I have a concept that owns a collection of enumeration values.
In the properties view, I created a (couple of) checkbox(es) that can be used to manipulate this collection. For each checkbox, I created model operations that attempt to add or remove the corresponding value from the collection.
Though I am able to add the element to the collection (by selecting the checkbox), I do not succeed removing the element (by unselecting the checkbox).
Assume that my language contains a enumeration called Format consisting of the literals PLAIN, ZIPPED.
Selection of the 'zipped' checkbox results in the execution of the model operation:
* Set
Feature Name: formats
Value expression: aql: drs::ReportFormat::PLAIN
Deselecting the zipped checkbox results in the execution of the model operation:
* Unset
Feature Name: formats
Value expression: aql: self.formats->select(f | f = drs::ReportFormat::PLAIN)
For some reason setting (or actually adding) the PLAIN format works, but unsetting doesn't.
Is there an error in my Value expression?
Regards,
Wilbert.
|
|
|
|
Re: Removing an enumeration from a collection [message #1819585 is a reply to message #1819584] |
Fri, 17 January 2020 10:28  |
Eclipse User |
|
|
|
Hi Julian,
Note that the type of formats is not a boolean, it is a collection of Enumeration values. If I am not mistaken, newValue in your suggestion represents the state of the checkbox and is a Boolean.
So either I don't understand your solution or it doesn't work. (Theoretically: it could also be that I don't understand it AND it doesn't work ;-) )
Regards,
Wilbert.
|
|
|
Powered by
FUDForum. Page generated in 0.04884 seconds