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: 337
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: 270
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 messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
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?
Re: Read-only session for image exporting [message #1847494 is a reply to message #1827922] Fri, 29 October 2021 03:23 Go to previous message
Ts Bao is currently offline Ts BaoFriend
Messages: 7
Registered: August 2021
Junior Member
Hi Denis,
I replied to this topic one year later, because I also encountered similar problems in the process of exporting images. Have you finally solved your problem? Could you tell me your solution?
I explained my problem in the topic

[Updated on: Fri, 29 October 2021 03:25]

Report message to a moderator

Previous Topic:Broken looking diagram image exports on Linux
Next Topic:CreateRepresentation API call fails with 'No handler found for event: CreateRepresentationInput'
Goto Forum:

Current Time: Wed Feb 08 02:22:44 GMT 2023

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

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

Back to the top