Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Problem : Create VSM programatically during execution
Problem : Create VSM programatically during execution [message #1794369] Wed, 29 August 2018 15:59 Go to next message
Alejandro Rodriguez is currently offline Alejandro RodriguezFriend
Messages: 1
Registered: August 2018
Junior Member
Hi,

I have been these days trying to create a "virtual" VSM in runtime. What I try to do is, given a project with an "model.ecore" model, and by pressing a button, to create a VSM (originally just with group > viewpoint > diagram description) and the "model.aird" of this model get the option to use the new VSM right after created.

The way I am trying to do is:

FIRST:

Create the elements that the VSM will contain:

Group group = DESCRIPTION_FACTORY.createGroup();
group.setName("virtualCPN");

Viewpoint viewpoint = DESCRIPTION_FACTORY.createViewpoint();
viewpoint.setName("virtualCPNviewpoint");
viewpoint.setModelFileExtension("ecore");

group.getOwnedViewpoints().add(viewpoint);

DiagramDescription dd = DESCRIPTION_FACTORY_DIAGRAM.createDiagramDescription();
dd.setName("virtualCPNdiagram");
dd.setDomainClass("ecore.EPackage");
dd.setInitialisation(true);

viewpoint.getOwnedRepresentations().add(dd);

SECOND:

Register the viewpoint in the ViewpointRegistry (with the registerFromWorkspace method, since the plugins have been already loaded).

Set<Viewpoint> vps = new HashSet<Viewpoint>();
vps.add(viewpoint);
ViewpointRegistry.getInstance().registerFromWorkspace(vps);

THIRD:

Get the session from the "model.aird" and create the representation with the DialectManager:

DialectManager.INSTANCE.createRepresentation("virtualCPN", semanticRoot, dd, session, new NullProgressMonitor());
Command createViewCommand = new CreateRepresentationCommand(createdSession, dd, rootObject," virtualCPN" , monitor);
createdSession.getTransactionalEditingDomain().getCommandStack().execute(createViewCommand);
SessionManager.INSTANCE.notifyRepresentationCreated(session);
session.save(new NullProgressMonitor());


I am doing something feasible? I am not sure if I am far away from a solution or it's just some adjusts to be done.

This is the further I have got, in spite of I get recognised the entry when I right click in the model.aird and go to Viewpoints selection, I get a "Not found" in the representations view of the model.aird (see image below).

https://i.imgur.com/Ph8nn9E.png

Edit: updated

[Updated on: Fri, 31 August 2018 06:58]

Report message to a moderator

Re: Problem : Create VSM programatically during execution [message #1794653 is a reply to message #1794369] Tue, 04 September 2018 13:55 Go to previous message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 161
Registered: June 2017
Senior Member
Hi,
It seems to be a bug in the aird editor. Can you activate your viewpoint from aird editor even with the not found label? And from viewpoint selection wizard?

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Multiline Label
Next Topic:Model Operations Open Wizard: specify Title/Description/IsPageComplete at page level
Goto Forum:
  


Current Time: Tue Sep 25 01:42:55 GMT 2018

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

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

Back to the top