Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Update semantic resource programmatically(Update model using a Recording Command)
icon1.gif  Update semantic resource programmatically [message #1715250] Fri, 20 November 2015 14:29 Go to next message
Giannis Kafousis is currently offline Giannis KafousisFriend
Messages: 3
Registered: November 2015
Junior Member
Hello community!

I have made an emf model and sirius diagram which I try to update programatically using a Recording Command. From what i have read this is the proper way of doing so. The rootObject of my model is an Analysis which has a name, an analyzer and some analysis params which are classes of my own defined in the emf model.

I have an xml file and when i save it an emf model instance is created programmatically. So I get the root element of my newly created model instance (updatedRootObject) and then I use a Recording Command to update the diagram like this:

String airdFilePath = "/my/aird/path";
URI airdFileURI = URI.createPlatformResourceURI(airdFilePath, true);
Session session = SessionManager.INSTANCE.getSession( airdFileURI, monitor);;

//get session root object
Analysis rootObj =  (Analysis) session.getSemanticResources().

//update root object
TransactionalEditingDomain editingDomain = session.getTransactionalEditingDomain();
CommandStack commandStack = editingDomain.getCommandStack();
RecordingCommand updateCommand = new RecordingCommand(editingDomain) {
     protected void doExecute() {

The semantic model gets updated BUT if my diagram is opened, my nodes overlap each other and I get the following exception.

	at org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand$
	at org.eclipse.gmf.runtime.diagram.ui.util.EditPartUtil.synchronizeRunnableToMainThread(
	at org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand.doExecuteWithResult(
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(
	at org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy.execute(
	at org.eclipse.gef.commands.CompoundCommand.execute(
	at org.eclipse.sirius.diagram.ui.internal.refresh.layout.SiriusCanonicalLayoutCommand.executeLayoutDueToExternalChanges(
	at org.eclipse.sirius.diagram.ui.internal.refresh.layout.SiriusCanonicalLayoutCommand.access$3(
	at org.eclipse.sirius.diagram.ui.internal.refresh.layout.SiriusCanonicalLayoutCommand$
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(
	... 24 more

Thank you in advance.

[Updated on: Mon, 23 November 2015 15:44]

Report message to a moderator

Re: Update semantic resource programmatically [message #1715442 is a reply to message #1715250] Mon, 23 November 2015 15:37 Go to previous message
Giannis Kafousis is currently offline Giannis KafousisFriend
Messages: 3
Registered: November 2015
Junior Member
This seems to be a bug connected to Sirius version 1. I updated to Sirius version 3 and the problem was finally solved!

[Updated on: Mon, 23 November 2015 15:39]

Report message to a moderator

Previous Topic:relation Edge in a container ?!
Next Topic:Container/Compartment in Containers without Domain class
Goto Forum:

Current Time: Wed Jan 27 17:34:40 GMT 2021

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

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

Back to the top