Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » switch operation problem
switch operation problem [message #1761796] Thu, 11 May 2017 15:09 Go to next message
Cyril Osdoit is currently offline Cyril OsdoitFriend
Messages: 23
Registered: March 2017
Junior Member
Hello,

I am using a pane based selection wizard for which I use a custom Java service returning a list of EObjets. To put each EObjets in a different feature I use a switch operation with
aql:element.oclIsTypeOf([mytype]])

the probem is that it seems to always go in the first case. I'd guess it would be because the objects go out as EObjects, but then it would rather go to my default since oclIsTypeOf returns true only if the object is of that type and not when it's a subtype.
Do you know what i'm doing wrong and how to fix it ?

Thanks in advance,
Cyril
Re: switch operation problem [message #1761807 is a reply to message #1761796] Thu, 11 May 2017 15:15 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
Hi Cyril,

oclIstypeOf() return only the type of the Object. To get inherited types you should use oclIsKindOf(). It's advisable to use oclIsKindOf() instead of oclIsTypeOf()

Regards,
Re: switch operation problem [message #1762968 is a reply to message #1761807] Fri, 12 May 2017 06:46 Go to previous messageGo to next message
Cyril Osdoit is currently offline Cyril OsdoitFriend
Messages: 23
Registered: March 2017
Junior Member
I used oclIsKindOf() but it doesn't change anything, I still have only the fist case that works.
Re: switch operation problem [message #1763297 is a reply to message #1762968] Fri, 12 May 2017 12:34 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
Hi Cyril,

Can you launch a validation on your Swich operation.
Are you sure, to had element typed like the condition, or the default case is not always true?

Regards,
Re: switch operation problem [message #1763398 is a reply to message #1763297] Mon, 15 May 2017 08:48 Go to previous messageGo to next message
Cyril Osdoit is currently offline Cyril OsdoitFriend
Messages: 23
Registered: March 2017
Junior Member
Hi Julien,

I launched a validation, I had no problem with my switch operation (I had some with other parts of my representation but that's not the point)
Here's a screenshot of my pane based selection

index.php/fa/29346/0/

Reminder : my returns a EList<EObject>

Connector, Component, Port and Property all directly inherit from Core_Element
Re: switch operation problem [message #1763399 is a reply to message #1763398] Mon, 15 May 2017 09:16 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
Hi Cyril,

I think I understood the problem.
In a selection wizard, even if selection multiple is not checked the result returned by the wizard is a list. So you must use an operation For, to use operation Switch.
Add an opeation For and put the operation Switch in.

Regards,
Re: switch operation problem [message #1763404 is a reply to message #1763399] Mon, 15 May 2017 10:30 Go to previous message
Cyril Osdoit is currently offline Cyril OsdoitFriend
Messages: 23
Registered: March 2017
Junior Member
The problem doesn't seem to come from the iteration, because If I select multiple Components they all get added. Anyway I tried to add a for before the switch, (used element as expression for the for and changed every occurence of element by i) and it didn't even work for Components. Even though it was a "for problem", why wouldn't it work with other elements like when I just try to add a port.

Regards,
Cyril
Previous Topic:behaviour
Next Topic:Label position of a workspace image of a container
Goto Forum:
  


Current Time: Sat Apr 27 04:08:29 GMT 2024

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

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

Back to the top