Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » programmatically create a second aird file
programmatically create a second aird file [message #1716509] Fri, 04 December 2015 13:12 Go to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
I want to copy an existing diagram and place it in a representation file that does not exist yet.

Copying a representation is not so difficult using the copyRepresentation() from the dialectmanager.

However creating a new representations file using SessionManager.INSTANCE.getSession("newRepresentationsUrl") results in the error:
"Found 2 main representations files (that means not referenced by another)...... A modeling project must contain only one."

How to solve this? How to add a reference of my new file to the original one


PS: basically its the same as what "extract to .aird file" does in eclipses project explorer menu

Re: programmatically create a second aird file [message #1716523 is a reply to message #1716509] Fri, 04 December 2015 14:14 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Koen


Le 04/12/2015 14:12, Koen Staal a écrit :
> I want to copy an existing diagram and place it in a representation file
> that does not exist yet.
>
> Copying a representation is not so difficult using the
> copyRepresentation() from the dialectmanager.
>
> However creating a new representations file using
> SessionManager.INSTANCE.getSession("newRepresentationsUrl") results in

This allows you to create a new Session (and you can have only one per
Modeling Project).

It seems you just want to create a new aird file, referenced from the
exisitng one to store one or many diagrams. So this will just be a copy
of the existing diagram and you want that both representations continue
to reference the same instance of the model ? (same instance, same
resourceset, same session).

> the error:
> "Found 2 main representations files (that means not referenced by
> another)...... A modeling project must contain only one."
> How to solve this? How to add a reference of my new file to the original
> one
>
>
> PS: basically its the same as what "extract to .aird file" does in
> eclipses project explorer menu

You might take a look to
org.eclipse.sirius.ui.tools.internal.views.common.action.ExtractRepresentationAction
and
org.eclipse.sirius.ui.tools.internal.wizards.ExtractRepresentationsWizard.performFinish()

>
>

Regards,


--
Maxime - Obeo

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


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: programmatically create a second aird file [message #1716526 is a reply to message #1716523] Fri, 04 December 2015 14:59 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 seems you just want to create a new aird file, referenced from the
>exisitng one to store one or many diagrams. So this will just be a copy
>of the existing diagram and you want that both representations continue
>to reference the same instance of the model ? (same instance, same
>resourceset, same session).

Yes i want to create a new aird file, referenced from the existing one.

Re: programmatically create a second aird file [message #1716530 is a reply to message #1716526] Fri, 04 December 2015 15:31 Go to previous message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
DAnalysis slaveAnalysis = ViewpointFactory.eINSTANCE.createDAnalysis();

to create a new analysis

now i only i have to look into
new PrepareNewAnalysisCommand(domain, pickedResource, slaveAnalysis, session) and new MoveRepresentationCommand(session, slaveAnalysis, representations);
Previous Topic:Internal error when trying to open an aird file
Next Topic:How to create Border Node with a Domain Class not in the semantic model
Goto Forum:
  


Current Time: Sat Apr 27 01:07:48 GMT 2024

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

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

Back to the top