Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Diagrams based on multiple/shared resource
Diagrams based on multiple/shared resource [message #1695279] Wed, 13 May 2015 09:33 Go to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
My current representation is created using a "main" file that uses other files. These files are defined in the main file as "import". When the representation is created i programmatically add these files using Session.addSemanticResource.

Currently when someone adds an import after the creation the session resources does not get updated.
Also In the same session there might be a different representation with the same import.

My question: How do i correctly update the resources of the session?


A trick could be to add the import to the representation but never draw them, this will give the opportunity to call Session.addSemanticResource if the resouce/file was not already added.
But then when deleting a resource from the session i will have to check all representations within the session to check if the resource is used by any representation, this seems kinda heavy on the workload.

Maybe i can point sirius to a method where it described which resources/files are used for a representation.
Re: Diagrams based on multiple/shared resource [message #1696055 is a reply to message #1695279] Thu, 21 May 2015 12:44 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 174
Registered: October 2014
Senior Member
Hi Koen

Le 13/05/2015 11:33, Koen Staal a écrit :
> My current representation is created using a "main" file that uses other
> files. These files are defined in the main file as "import". When the
> representation is created i programmatically add these files using
> Session.addSemanticResource.
> Currently when someone adds an import after the creation the session
> resources does not get updated. Also In the same session there might be
> a different representation with the same import.
>
Using import simply imports a file into your project.
If you want representations on your semantic models, rather than making
code calling Session.addSemanticResource, you can simply use "Add Model"
in contextual menu on your aird file. [1]

> My question: How do i correctly update the resources of the session?
>
>
> A trick could be to add the import to the representation but never draw
> them, this will give the opportunity to call Session.addSemanticResource
> if the resouce/file was not already added. But then when deleting a
> resource from the session i will have to check all representations
> within the session to check if the resource is used by any
> representation, this seems kinda heavy on the workload.
>
> Maybe i can point sirius to a method where it described which
> resources/files are used for a representation.
To remove a semantic model use "Remove model" on your model under
"Project dependencies" tree node.

Regard
Laurent

[1]
https://www.eclipse.org/sirius/doc/user/general/Modeling%20Project.html#ProjectDependencies


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Diagrams based on multiple/shared resource [message #1696127 is a reply to message #1696055] Fri, 22 May 2015 08:53 Go to previous messageGo to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
Thanks for your response. It helped in some way.

I came to the conclusion that adding the resources is not the problem but rather the way the diagram gets updated.
I am using xtext to write my own language, where it is able to import another file. I will try to explain my problem with a simplified situation below:
--------
MainFile.txt
import secondFile.txt

class Patrick extends Parent
..


secondFile.txt

class Suzanne extends Parent
..

--------
Both files are in the project in the same folder.
When creating a (parent)diagram of the mainfile, this will show Patrick and Suzanne.
When changing the name of Suzanne to Suz in secondFile and saving it, the diagram will show an error. It can no longer find the reference to suzanne.

When saving the mainfile the diagram gets updated correctly, suzanne is now changed to suz. (Saving the mainfile to add changes in an other file is not what i want my users to do)

How can i make sure the diagram gets updated when a referenced resource gets changed?

[Updated on: Fri, 22 May 2015 08:57]

Report message to a moderator

Re: Diagrams based on multiple/shared resource [message #1696452 is a reply to message #1695279] Tue, 26 May 2015 14:23 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Koen,

Le 13/05/2015 11:33, Koen Staal a écrit :
> My current representation is created using a "main" file that uses other
> files. These files are defined in the main file as "import". When the
> representation is created i programmatically add these files using
> Session.addSemanticResource.
> Currently when someone adds an import after the creation the session
> resources does not get updated.

What do you mean by "not get updated"?

> Also In the same session there might be
> a different representation with the same import.
>
> My question: How do i correctly update the resources of the session?
>
>
> A trick could be to add the import to the representation but never draw
> them, this will give the opportunity to call Session.addSemanticResource
> if the resouce/file was not already added. But then when deleting a
> resource from the session i will have to check all representations
> within the session to check if the resource is used by any
> representation, this seems kinda heavy on the workload.
>
> Maybe i can point sirius to a method where it described which
> resources/files are used for a representation.



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Diagrams based on multiple/shared resource [message #1696455 is a reply to message #1696127] Tue, 26 May 2015 14:34 Go to previous message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Koen,

It is a Xtext/Sirius integration issue, for this integration we can look
at [1], [2] & [3].

[1] https://www.eclipse.org/Xtext/documentation/308_emf_integration.html
[2]
https://www.eclipsecon.org/france2014/sites/default/files/slides/Xtext_Sirius.pdf
[3] https://github.com/ObeoNetwork/Xtext-Sirius-integration


Le 22/05/2015 10:53, Koen Staal a écrit :
> Thanks for your response. It helped in some way.
>
> I came to the conclusion that adding the resources is not the problem
> but rather the way the diagram gets updated.
> I am using xtext to write my own language, where it is able to import
> another file. I will try to explain my problem with a simplified
> situation below:
>
> MainFile.txt
> import secondFile.txt
>
> class Patrick extends Parent
> .
>
> secondFile.txt
>
> class Suzanne extends Parent
> .
>
> Both files are in the project in the same folder.
>
> When creating a (parent)diagram of the mainfile, this includes Patrick
> and Suzanne.
> When changing the name of Suzanne to Suz in secondFile and saving it,
> the diagram will show an error. It can no longer find the reference to
> suzanne.
> When saving the mainfile the diagram gets updated correctly, suzanne is
> now changed to suz.
>
> How can i make sure the diagram gets updated when a referenced resource
> gets changed.
>
>



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Model change validation
Next Topic:Use EMF's node Any in Sirius
Goto Forum:
  


Current Time: Wed Jan 27 20:21:21 GMT 2021

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

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

Back to the top