|Problem : Create VSM programatically during execution [message #1794369]
||Wed, 29 August 2018 15:59
| Alejandro Rodriguez
Registered: August 2018
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:
Create the elements that the VSM will contain:
Group group = DESCRIPTION_FACTORY.createGroup();
Viewpoint viewpoint = DESCRIPTION_FACTORY.createViewpoint();
DiagramDescription dd = DESCRIPTION_FACTORY_DIAGRAM.createDiagramDescription();
Register the viewpoint in the ViewpointRegistry (with the registerFromWorkspace method, since the plugins have been already loaded).
Set<Viewpoint> vps = new HashSet<Viewpoint>();
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);
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).
[Updated on: Fri, 31 August 2018 06:58]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01755 seconds