Skip to main content



      Home
Home » Eclipse Projects » Sirius » Cannot use "Unset" operation on attributes
Cannot use "Unset" operation on attributes [message #1791375] Thu, 28 June 2018 08:46 Go to next message
Eclipse UserFriend
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 09:22] by Moderator

Re: Cannot use "Unset" operation on attributes [message #1791381 is a reply to message #1791375] Thu, 28 June 2018 09:45 Go to previous messageGo to next message
Eclipse UserFriend
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 04:03 Go to previous message
Eclipse UserFriend
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
Previous Topic:Diificulties to create a node
Next Topic:the following mapping semantic candidates expression could not be correctly evaluated :
Goto Forum:
  


Current Time: Sun Jul 27 05:14:59 EDT 2025

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

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

Back to the top