Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » export editor diagram to a jpeg file without physically opening the editor
export editor diagram to a jpeg file without physically opening the editor [message #237273] Fri, 27 July 2007 20:25 Go to next message
Shannon Wei is currently offline Shannon WeiFriend
Messages: 10
Registered: July 2009
Junior Member
Hi,

I'm looking for a way to export gef editor diagram to a jpeg file without
physically opening the editor in eclipse and gef 3.22.

The code worked prior to eclipse and gef 3.2.
1. Initiate a multipage editor.
2. Editor creates a part control.
3. Add graphicalEditor to the multipage editor page.
4. Get graphicalViewer of graphicalEditor .
5. Get printable layer from graphicalViewer.
6. Convert printable layer figure to jpeg.
7. Dispose multipage editor.

It doesn't work in eclipse and gef 3.22. After exporting diagram to jpeg and
then changing eclipse perspective, the workspace is messed up. It seems
editor instance is still hanging around.



Help is greatly appreciated.

Shannon
....

final IEditorPart editor =
(IEditorPart)WorkbenchPlugin.createExtension(desc.getConfigu rationElement(),
"class");

final EditorSite site = new EditorSite(null, editor, page, desc);



try {

....


editor.init(site, source);

editor.createPartControl(window.getShell()); // editor is a
MultiPageEditorPart, add org.eclipse.gef.ui.parts. GrahpicalEditor to the
editor page



....

}catch(...){

}

Object graphicalViewer = editor.getAdapter(GraphicalViewer.class);

if (graphicalViewer instanceof GraphicalViewer){

this.viewer = (GraphicalViewer)graphicalViewer;

IFigure printableLayer = null;

LayerManager lm = (LayerManager)
((GraphicalViewer)graphicalViewer).getEditPartRegistry().get (LayerManager.ID);

IFigure printLayer = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);

// convert printLayer figure to jpeg.

editor.dispose();
Re: export editor diagram to a jpeg file without physically opening the editor [message #237278 is a reply to message #237273] Sat, 28 July 2007 21:12 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

You need to draw the diagram off-screen. Take a look at DiagramGenerator
class and its subclasses in GMF project - it's already done there.

Cheers,
Alex
Previous Topic:TransferDropTargetListener.drop() -> ContainerEditPolicy.getCreateCommand
Next Topic:How to capture double click on GEF Container
Goto Forum:
  


Current Time: Thu Apr 18 23:38:46 GMT 2024

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

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

Back to the top