|
Re: Export diagram as image on Save action [message #1384805 is a reply to message #1384696] |
Mon, 02 June 2014 08:24 |
|
Le 30/05/2014 19:54, Mate Attila a écrit :
> Hi,
>
> I'd like to export diagrams as image when model is saved by user, and I
> need some help on how to do it. Should I use
> org.eclipse.sirius.sessionManagerListener extension and listen to
> specific notifications?
I think you could try to use a SessionManagerListener and react to
org.eclipse.sirius.business.api.session.SessionListener.SYNC in
notify(Session, int).
How can I export diagrams via API?
You could call:
org.eclipse.sirius.ui.business.api.dialect.DialectUIManager.INSTANCE.export(representation,
session, filePath, exportFormat,progressMonitor);
or adapt the following snippet:
// Use the
org.eclipse.sirius.diagram.ui.tools.api.part.DiagramEditPartService to
use the figure validation infinite loop safe SiriusDiagramGraphicalViewer.
final CopyToImageUtil imageUtility = new DiagramEditPartService();
....
imageUtility.copyToImage(Diagram,IPath,ImageFileFormat, IProgressMonitor
path,
imageFileFormat,
new NullProgressMonitor(),
PreferencesHint.USE_DEFAULTS);
See also org.eclipse.sirius.ui.tools.api.actions.export.ExportAction
>
> Thanks in advance!
> Attila
>
Regards
Maxime
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Export diagram as image on Save action [message #1384986 is a reply to message #1384805] |
Tue, 03 June 2014 13:28 |
Mate Attila Messages: 2 Registered: May 2014 |
Junior Member |
|
|
Hi Maxime,
Thanks, I've managed to get it working. Is it possible to customize image quality? I mean exported image is less 'fancy' then it is in Sirius editor (no color gradients, etc.). It's also the case when I export diagrams manually, but I'm wondering if it's possible to change export image quality in code.
Another question about API: is there any documentation about Sirius API? I found diagram editors documentation, but is there a documentation where for example I can read about Sirus Session management, how to create diagrams from code, how to extend/contribute to Sirius Model Explorer?
Btw Sirius is a really great product, thanks for contributing it!
Best regards,
Attila
|
|
|
Re: Export diagram as image on Save action [message #1385080 is a reply to message #1384986] |
Wed, 04 June 2014 08:55 |
|
Le 03/06/2014 15:28, Mate Attila a écrit :
> Another question about API: is there any documentation about Sirius API?
> I found diagram editors documentation, but is there a documentation
> where for example I can read about Sirus Session management, how to
> create diagrams from code, how to extend/contribute to Sirius Model
> Explorer?
We used to have a "Developer" section in the documentation (before the
product was open sourced as Sirius), but it was inconsistent and
sometimes completely obsolete. We did not have enough time to rewrite it
for Sirius 1.0, so it has been removed to avoid confusion.
We certainly want to have such a documentation in the future. Feel free
to comment on https://bugs.eclipse.org/bugs/show_bug.cgi?id=426583 to
tell us what kind of information you expect in priority for such a
document (for us who have been working on Sirius for years, it is not
always obvious what a newcomer needs).
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.03458 seconds