Community
Participate
Working Groups
Build Identifier: Version: 3.7.1 Build id: 20110916-0149 This is to request an API extension in Graphiti to gain access to the printing and export diagram functionality. There is currently no public API to functionality such as Graphiti's PrintFigureDialog or any of the diagram export utilities built into the editor. The rationale behind this is to be able to generate printable product that is 1. based on scalable graphics (ie exported svg then to pdf or printer) 2. can have a printable region (e.g. print current view, print selected region) There may be other use cases but these were apparent to me. Reproducible: Didn't try
The functionalitity should be available without the need to have an active diagram editor. This request will due to capacity limitations unfortunatly not fit into the Juno timeframe, unless there are contributions in this area.
We use a Eclipse based tool for our model based requirement and development process. As part of that we create documentation for models and diagrams in a generic way (supporting several DSL's and diagram providers like GMF and Graphiti). To do that we have the need to export a diagram content as image in a programatic way from a plugin in Eclipse. This documentation generation is also available in a headless Eclipse (without UI). Vote +1
I think this is a very useful feature that we would need as well. Vote +1.
Increased priority, let's see what we can do for Kepler
+1. It's important for me too. tks
Marked for Kepler
I started to work on this topic with the printing. The work is still in progress, nevertheless I would like to provide the current status and an outlook on what might be expected here: I moved the IPrintFeature/DefaultPrintFeature/PrintContext to an API package so clients may use them. During that I also refactored some of the functionality so that clients can influence hopefully all aspects of the printing process. This is available already on my local machine and still needs some fine tuning in order to be checked in. But I hope to get that ready soon. But at least currently it is only possible to use the printing functionality from within an open editor (or at least having one at hand), because what is being printed is defined with help of an open and initialized GraphicalViewer (GEF instance). More technically: currently we need to use the graphical viewer from the editor to provide what diagram to print. To avoid the editor we need to somehow have another correctly initialized instance of it available; this might in the future e.g. be a graphical viewer hosted inside an Eclipse view (see enhancement request https://bugs.eclipse.org/bugs/show_bug.cgi?id=352120) or another viewer provided by clients. The new printing API would enable clients to provide such a viewer but that is not trivial.
I pushed a first version of what I changed to Gerrit just to preserve it and maybe to get some checking if this goes into the right direction: https://git.eclipse.org/r/#/c/9329/
I have pushed the enhancement to Gerrit for review, please have a look if it fulfills the requirements: https://git.eclipse.org/r/9329 It addresses the issue of the print and save as image features not being part of the API. They are now and may be overridden and changed by clients. However, they always need an open diagram to execute; this currently means an open diagram editor. In the future there might be better alternatives to get to an open diagram, see the current development happening for diagrams in views (https://bugs.eclipse.org/bugs/show_bug.cgi?id=352120). One issue that we cannot address is that SWT is and will be needed for printing and exporting to a file. Our implementation and the underlying GEF heavily rely on SWT being active.
The change has been merged to master for Kepler M6
There is now a new API that allows clients to adapt the print and save as image functionality according to their needs. In combination with the new diagram in views possibilities clients can retrieve a GraphicalViewer not only from editors, but also from views and popups which allows for more flexibility in the usage of this feature. A non-UI layer dependent usage of print and save as image is currently not possible as GEF itself is relying on the UI being present.