Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Removing an enumeration from a collection(Sirius unset tool)
Removing an enumeration from a collection [message #1819578] Fri, 17 January 2020 14:09 Go to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 209
Registered: June 2010
Senior Member
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 #1819584 is a reply to message #1819578] Fri, 17 January 2020 15:25 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
Hello Wilbert,

For use the checkbox in the properties view you just need to use
* Set
Feature Name: formats
Value expression: var:newValue
Don't need to used the unset operation, it's managed automatically by the checkbox.

Regards,
Re: Removing an enumeration from a collection [message #1819585 is a reply to message #1819584] Fri, 17 January 2020 15:28 Go to previous message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 209
Registered: June 2010
Senior Member
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.
Previous Topic:operation after navigation
Next Topic:Creating aird in editor
Goto Forum:
  


Current Time: Fri Mar 29 15:24:35 GMT 2024

Powered by FUDForum. Page generated in 0.02148 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top