Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Read-only session for image exporting
Read-only session for image exporting [message #1827922] Wed, 27 May 2020 05:37 Go to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 283
Registered: August 2013
Senior Member

I'm using such a code to export a diagram to an external image file:
        Session session = SessionManager.INSTANCE.getSession(reprURI, new NullProgressMonitor());
        ExportFormat exportFormat = new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG,
                ScalingPolicy.AUTO_SCALING, 50);
        DialectUIManager.INSTANCE.export(desc.getRepresentation(), session, imagePath,
                exportFormat, new NullProgressMonitor());

An aird file is contained inside a plugin's jar file. So it should not me modified. reprURI has the following form: platform:/plugin/...

The problem is that I get the following exception:
java.lang.RuntimeException: Session creation failed
	at org.eclipse.jface.operation.ModalContext$
Caused by: org.eclipse.core.runtime.CoreException: Session creation failed
	... 5 more
Caused by: protocol doesn't support output
	at Source)
	at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createOutputStream(
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(
	... 8 more

Is it possible to create a read-only session? Or is there an alternative way to export an image?
Re: Read-only session for image exporting [message #1828256 is a reply to message #1827922] Fri, 05 June 2020 06:58 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 265
Registered: August 2010
Senior Member

Sorry for the delay.

It is unexpected since image export should not modify the Sirius Session and trigger the Session saving.
The stack suggests that your code attempted to create a new resource (EMF) in the Session. It's hard yo say more without the complete call stack.


Re: Read-only session for image exporting [message #1828494 is a reply to message #1828256] Wed, 10 June 2020 18:16 Go to previous message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 503
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Denis,

Regarding the call stack, it seems that there is no existing aird file corresponding to your reprURI. This triggers the session resource creation and the save attempt.
Could you check your uri ? do you execute the code from a runtime or form a built product (regarding how you built your uri, you might be impacted by


(The code checking the existence is done with ted.getResourceSet().getURIConverter().exists(sessionResourceURI, null);)

Maxime Porhel - Obeo

Need training or professional services for Sirius?
Previous Topic:Determining the order
Next Topic:Domain Model Migration and Sirius
Goto Forum:

Current Time: Tue May 18 09:14:21 GMT 2021

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

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

Back to the top