Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Sub-containers on diagram inside same container(Questions about subcontainers on diagram)
Sub-containers on diagram inside same container [message #1587348] Tue, 27 January 2015 09:36 Go to next message
sninja sninja is currently offline sninja sninjaFriend
Messages: 31
Registered: October 2013
Member
Hi,
Been using Sirius for a while, it's working great, but now I want to use sub-containers and I have a problem.

Example: House is a container and rooms are sub-containers. I have edge relations between houses and edge relations between rooms inside a house.

I know how to create house container and edge relation between house containers and everything works fine.

Using same principle, I create kitchen container and bathroom container inside house container, and I create edge relation between kitchen and bathroom containers.

Now I want to create tools for diagram. I create house container as parallelogram with child elements as free form. I create kitchen and bathroom containers and everything shows on diagram. I click on house container, it shows on diagram, then I click on kitchen and it shows, also like that for bathroom.

1. problem:
Set name under Create instance, which enables me to show custom name for container on diagram, works for house container, but not for kitchen and bathroom sub-containers. It always stays in form of label, like it doesn't sees name feature. It works for house container.

2. problem
Edge relation won't show on diagram when I use mouse, but when I use model editor to define relation between kitchen and bathroom, it shows on diagram after.

So, everything is good when I use model editor, but through diagram I can't create edge relation to be visible. Once again, everything works on container level, but on sub-container level I have problems.

I suspect that solution lies somewhere in Change context option, maybe I don't define something for sub-containers and their edge relations to be visible on diagram inside container...

Bonus question:
One more thing, how to put name of the node inside lozenge shape? I use free form for children. I saw in documentation example of that, but no instructions.

Thanks upfront


Re: Sub-containers on diagram inside same container [message #1587369 is a reply to message #1587348] Tue, 27 January 2015 09:50 Go to previous messageGo to next message
sninja sninja is currently offline sninja sninjaFriend
Messages: 31
Registered: October 2013
Member
Hi, small update...

I apologize, I just solved 1 problem and bonus question.

For the 1 problem, my label expression was fixed instead of [self.name/], and for the bonus question, I changed label position from border to node.

Sorry about that.

So, it's just about edge relation between sub-containers not showing inside container when I try to create it on diagram.

Thanks again

[Updated on: Tue, 27 January 2015 09:51]

Report message to a moderator

Re: Sub-containers on diagram inside same container [message #1589205 is a reply to message #1587369] Wed, 28 January 2015 09:47 Go to previous messageGo to next message
sninja sninja is currently offline sninja sninjaFriend
Messages: 31
Registered: October 2013
Member
Hi,
I was trying out couple of stuff, but still no luck. The thing is that sometimes I manage to make change through diagram, but relation is not visible. So, in order to get precise help, here is the example model:
index.php/fa/20630/0/

So, house is a container, kitchen and bathroom sub-containers. I use element based edges H2H and K2B.

For h2h edge I made it like this:

Domain class: model.House
Source mapping: House
Source finder expression: [self.eInverse()/]
Target mapping: House
Target finder expression: [h2HTarget/]

In the tools section, I made it like this:
Edge creation
---Edge mappings: h2h
Change context source
---Browse expression: source
Create instance
---Reference name: h2H
---Type name: model.H2H
---Variable: instance
Set h2H
---Feature name: h2H
---Value expression: [h2H->including(target)]
Set h2HTarget
---Feature name: h2HTarget
---Value expression: [h2HTarget->including(target)]


For k2b edge I made it like this:

Domain class: model.K2B
Source mapping: Kitchen
Source finder expression: [self.eInverse()/]
Target mapping: Bathroom
Target finder expression: [k2BTarget/]

In the tools section, I made it like this:
Edge creation
---Edge mappings: k2b
Change context source
---Browse expression: source
Create instance
---Reference name: k2B
---Type name: model.K2B
---Variable: instance
Set k2B
---Feature name: k2B
---Value expression: [k2B->including(target)]
Set k2BTarget
---Feature name: k2BTarget
---Value expression: [k2BTarget->including(target)]


And it will not work. When I try to connect kitchen and bathroom, or house and house, nothing happens.

It is interesting that when I remove from the second Set (from h2HTarget and k2BTarget) including(target) from value expression , then it makes the change in diagram, but line is not visible.

So, what am I doing wrong?

Thanks

[Updated on: Wed, 28 January 2015 09:54]

Report message to a moderator

Re: Sub-containers on diagram inside same container [message #1589754 is a reply to message #1589205] Wed, 28 January 2015 16:40 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 252
Registered: July 2009
Senior Member
Le 28/01/2015 10:47, sninja sninja a écrit :
> Hi,

Hi,

> I was trying out couple of stuff, but still no luck. The thing is that sometimes I manage to make change through diagram, but relation is not visible. So, in order to get precise help, here is the example model:
>
>
> So, house is a container, kitchen and bathroom sub-containers. I use element based edges H2H and K2B.
>
> For h2h edge I made it like this:
>
> Domain class: model.House
> Source mapping: House
> Source finder expression: [self.eInverse()/]
> Target mapping: House
> Target finder expression: [h2HTarget/]
>
> In the tools section, I made it like this:
> Edge creation
> Edge mappings: h2h
> Change context source
> Browse expression: source
> Create instance
> Reference name: h2H
> Type name: model.H2H
> Variable: instance
> Set h2H
> Feature name: h2H
> Value expression: [h2H->including(target)]
> Set h2HTarget
> Feature name: h2HTarget
> Value expression: [h2HTarget->including(target)]
>
>
> For k2b edge I made it like this:
>
> Domain class: model.K2B
> Source mapping: Kitchen
> Source finder expression: [self.eInverse()/]
> Target mapping: Bathroom
> Target finder expression: [k2BTarget/]
>
> In the tools section, I made it like this:
> Edge creation
> Edge mappings: k2b
> Change context source
> Browse expression: source
> Create instance
> Reference name: k2B
> Type name: model.K2B
> Variable: instance
> Set k2B
> Feature name: k2B
> Value expression: [k2B->including(target)]
> Set k2BTarget
> Feature name: k2BTarget
> Value expression: [k2BTarget->including(target)]
>
>
> And it will not work. When I try to connect kitchen and bathroom, or house and house, nothing happens.
>
> It is interesting that when I remove from the second Set (from h2HTarget and k2BTarget) including(target) from value expression , then it makes the change in diagram, but line is not visible.
>
> So, what am I doing wrong?

I've not read all your use case (sorry). But you can find an example of
edge creation between 2 sub-containers in EcoreTools [1]. You can find
the corresponding odesign here [2], and a tool to create edge between 2
classes (sub-container in package) [3].
I hope this example will help you.


>
> Thanks
>

Regards,

[1] https://projects.eclipse.org/projects/modeling.emft.ecoretools/
[2]
http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design/description/ecore.odesign?h=2.0
[3]
http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design/description/ecore.odesign?h=2.0#n529

--
Laurent - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Sub-containers on diagram inside same container [message #1593172 is a reply to message #1589754] Fri, 30 January 2015 13:12 Go to previous message
sninja sninja is currently offline sninja sninjaFriend
Messages: 31
Registered: October 2013
Member
Hello,

Here is the solution:

For h2h edge:

Domain class: model.H2H
Source mapping: House
Source finder expression: feature:eContainer
Target mapping: House
Target finder expression: feature:h2HTarget

Tools section:
Edge creation
---Edge mappings: h2h
Change context source
---Browse expression: var:source
Create instance
---Reference name: h2H
---Type name: model.H2H
---Variable: instance
Set h2HTarget
---Feature name: h2HTarget
---Value expression: var:target

Note: It's interesting that for containers on this level, the highest level, this also works, I don't get it why:

Domain class: model.H2H
Source mapping: House
Source finder expression: [self.eInverse()/]
Target mapping: House
Target finder expression: [h2HTarget/]

Tools section:
Edge creation
---Edge mappings: h2h
Change context source
---Browse expression: source
Create instance
---Reference name: h2H
---Type name: model.H2H
---Variable: instance
Set h2H
---Feature name: h2H
---Value expression: [h2H->including(target)]
Set h2HTarget
---Feature name: h2HTarget
---Value expression: [h2HTarget->including(target)/]

But the first solution is more elegant and the way that needs to be done.

For k2b edge it's same principle:

Domain class: model.K2B
Source mapping: Kitchen
Source finder expression: feature:eContainer
Target mapping: Bathroom
Target finder expression: feature:k2BTarget

Tools section:
Edge creation
---Edge mappings: k2b
Change context source
---Browse expression: var: source
Create instance
---Reference name: k2B
---Type name: model.K2B
---Variable: instance
Set k2BTarget
---Feature name: k2BTarget
---Value expression: var:target

That's it.
Previous Topic:man32.png missing from tutorial downloads
Next Topic:Adding elements dynamically
Goto Forum:
  


Current Time: Thu Apr 02 08:55:36 GMT 2020

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

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

Back to the top