|
Re: Export diagram without workspace [message #1753848 is a reply to message #1753667] |
Fri, 10 February 2017 16:49 |
|
Hi,
you can do something like
// Get session from an absolute path (not in a workspace)
URI sessionResourceURI = URI.createFileURI("D:/folder/representations.aird");
Session session = SessionFactory.INSTANCE.createSession(sessionResourceURI, new NullProgressMonitor());
session.open(new NullProgressMonitor());
// 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 SVG image
ExportFormat exportFormat = new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.SVG);
DialectUIManager.INSTANCE.export(representation, session, new Path("D:/folder/image.svg"), exportFormat,
new NullProgressMonitor());
Regards,
Laurent
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: Export diagram without workspace [message #1781778 is a reply to message #1780505] |
Tue, 13 February 2018 09:53 |
|
Hi Marianna,
It seems that you do not use the expected resource factory: aird resources needs the org.eclipse.sirius.business.internal.resource.AirDResourceFactory (it brings the automatic migration of Sirius resources).
Note that you could also try org.eclipse.sirius.business.api.session.INSTANCE.getSession(uri, progressmonitor) and then open the session or org.eclipse.sirius.business.api.session.INSTANCE.openSession(URI, IProgressMonitor, UICallBack) (with SiriusEditPlugin.getPlugin().getUiCallback() or a new org.eclipse.sirius.tools.api.command.ui.NoUICallback regarding your context) instead of the use of the session factory.
Regards
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.03302 seconds