Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Programmatically exporting image from aird in stand-alone situation
Programmatically exporting image from aird in stand-alone situation [message #1805472] Mon, 15 April 2019 18:54 Go to next message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 11
Registered: January 2018
Junior Member
Hi all,

I'm trying to export a PNG image from my .aird file in a standalone situation where the following code is initiated by an MWE2 workflow in a Standalone setup.

Using this forum I got this far:
			Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("aird", new AirDResourceFactory());"Exporting image of " + getAirdFile() + " file to " + getImageFileName());
			IProgressMonitor progressMonitor = BasicMonitor.toIProgressMonitor(new LoggerMonitor(log));
			// Get session from an absolute path (not in a workspace)
			URI sessionResourceURI = URI.createFileURI(getAirdFile());
			Session session = SessionFactory.INSTANCE.createSession(sessionResourceURI, progressMonitor);
			//Session session = SessionManager.INSTANCE.openSession(sessionResourceURI, progressMonitor, noUICallback, false);;
			// Get the expected representation (here the first of the first DView)
			DViewQuery query = new DViewQuery(session.getOwnedViews().iterator().next());
			DRepresentation representation = query.getLoadedRepresentations().get(0);
			// Export it as PNG image
			ExportFormat exportFormat = new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG);
			DialectUIManager.INSTANCE.export(representation, session, new Path(getImageFileName()), exportFormat,

But when I do this, I get an error:
java.lang.RuntimeException: Problems running workflow nl.tno.esdl.ReleaseESDL: null
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(
Caused by: java.lang.NullPointerException
	at nl.tno.esdl.EcoreImageGenerator.invoke(

In DAnalysisSelectorService the following code is executed:
if (defaults == null || defaults.isEmpty()) {
            SiriusPlugin.getDefault().warning(MessageFormat.format(Messages.DAnalysisSelectorService_noDefaultWarningMsg, ID), null);
            defaultSiriusProvider = new DefaultAnalysisSelectorProvider();

SiriusPlugin.getDefault() returns null here.

How can I run this code in a standalone way?

Re: Programmatically exporting image from aird in stand-alone situation [message #1805881 is a reply to message #1805472] Fri, 26 April 2019 12:05 Go to previous message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 166
Registered: October 2014
Senior Member

SiriusPlugin.getDefault() is null because you code is executed out of eclipse context. Sirius is not supposed to work in standalone application. Perhaps some part of Sirius may work by chance in some cases but it has never been tested.


Laurent Fasani - Obeo
Need training or professional services for Sirius?
Previous Topic:Getting java.lang.IllegalArgumentException: Argument not valid exception
Next Topic:Loading Resource file
Goto Forum:

Current Time: Thu Feb 27 21:42:37 GMT 2020

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

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

Back to the top