Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Cannot use "Unset" operation on attributes
Cannot use "Unset" operation on attributes [message #1791375] Thu, 28 June 2018 12:46 Go to next message
Maged Elaasar is currently offline Maged ElaasarFriend
Messages: 21
Registered: September 2013
Junior Member
Hello. In my metamodel, I have a class with an attribute whose type is a list of integers. In the odesign model, I want to use an Unset operation on an object of this class to remove some integers from the list. Unfortunately, it looks like the operation only supports an "Element expression" not a "Value Expression", which means it does not work with an expression that returns a list of integers.

I cannot find any other operation that I can use to accomplish this. I tried to use a Set operation with a list of integers minus the one I want to remove but that did not work (it only adds new ones but does not delete existing ones). I also tried creating an external Java action, by defining a class and registering it with the extension point, following the documentation, but when I then create an External Java Action Call operation, I don't see any values in the drop down for "Action", not even the standard actions out of the box. The documentation also talks about "External Java Action" operation but I don't see this as an option under "New Operation" menu.

Any help would be greatly appreciated.

[Updated on: Thu, 28 June 2018 13:22]

Report message to a moderator

Re: Cannot use "Unset" operation on attributes [message #1791381 is a reply to message #1791375] Thu, 28 June 2018 13:45 Go to previous messageGo to next message
Maged Elaasar is currently offline Maged ElaasarFriend
Messages: 21
Registered: September 2013
Junior Member
I just noticed that the External Java Action option is in the menu New Extension not New Operation. Now, it works for me. However, ideally, I should not have needed to do this had the standard Unset operation used a Value Expression as opposed to Element Expression.
Re: Cannot use "Unset" operation on attributes [message #1791422 is a reply to message #1791375] Fri, 29 June 2018 08:03 Go to previous message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 134
Registered: October 2014
Senior Member
Hello

The unset operation will remove every value given by the Element expression. Effectively, it currently manages only Collection<EObject> and Integer is not an EObject.
I do not see any reason why it should not managed Collection<Integer>, so I've created a bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=536454 to handle this issue.

As a workaround, you may define an Unset operation with empty Element expression (this will remove the whole list) followed by a Set operation to set the new list.

About "External Java Action", I would advise to use a call service instead. See documentation [1]
You can call a service creating a "Change Context" operation with service:myService as Value Expression

Regards
Laurent

[1] https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Diificulties to create a node
Next Topic:Container drop and container creation
Goto Forum:
  


Current Time: Sat Sep 22 09:31:56 GMT 2018

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

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

Back to the top