Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Export diagram as image on Save action
Export diagram as image on Save action [message #1384696] Fri, 30 May 2014 13:38 Go to next message
Mate Attila is currently offline Mate AttilaFriend
Messages: 2
Registered: May 2014
Junior Member
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? How can I export diagrams via API?

Thanks in advance!
Attila
Re: Export diagram as image on Save action [message #1384805 is a reply to message #1384696] Mon, 02 June 2014 08:24 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 108
Registered: July 2009
Senior Member
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
Re: Export diagram as image on Save action [message #1384986 is a reply to message #1384805] Tue, 03 June 2014 13:28 Go to previous messageGo to next message
Mate Attila is currently offline Mate AttilaFriend
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 Smile (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 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 144
Registered: July 2009
Senior Member
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).
Previous Topic:Question about incompatibilities
Next Topic:Diagram refreshing and Java service Debugging
Goto Forum:
  


Current Time: Wed Nov 26 09:23:08 GMT 2014

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

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