Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » display diagram in stand-alone application
display diagram in stand-alone application [message #239619] Mon, 05 November 2007 16:06 Go to next message
hoang_vu is currently offline hoang_vuFriend
Messages: 11
Registered: July 2009
Junior Member
I am building a java project which will show the diagram from gmf model.
My application takes 2 file as input: the diagram file and the model file
( may be placed any where in the file system, not only in the workspace)
and output is display the diagram on the Tab panel.

I spent weeks with many solutions : export to a image file and read it
back, read the diagram directly, and the main problem is that I can get
the diagram from a diagram file ( probably because some example I got
always try to read a diagram file inside a workspace)

Does anyone have solution or some snippet code which fit my requirement?

Thanks,
Hoang
Re: display diagram in stand-alone application [message #239630 is a reply to message #239619] Tue, 06 November 2007 09:46 Go to previous messageGo to next message
hoang_vu is currently offline hoang_vuFriend
Messages: 11
Registered: July 2009
Junior Member
below is my code which try to save the diagram in a file as a gif file.
the problem happen since the resource content always be null.

public class _test_ {
public static void main(String argv[])
{
CopyToImage();
}
public static void CopyToImage()
{
String outputFileName = "E:\\wheel.gif";
String inputFileName = "E:\\wheel.saveccm";
File output = new File(outputFileName);
//JFileChooser fc = new JFileChooser();
URI uri = URI.createFileURI(inputFileName);
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = resourceSet.createResource(uri);
if(resource instanceof XMIResourceImpl){
Object object = resource.getContents().get(0);
CopyToImageUtil copyToImageUtil = new CopyToImageUtil();
try {
copyToImageUtil.copyToImage((Diagram)
object, Path.fromOSString(output.getAbsolutePath()), ImageFileFormat.GIF,
null, PreferencesHint.USE_DEFAULTS);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}

}
}
Re: display diagram in stand-alone application [message #239678 is a reply to message #239630] Wed, 07 November 2007 21:10 Go to previous message
hoang_vu is currently offline hoang_vuFriend
Messages: 11
Registered: July 2009
Junior Member
Noone can help me? I am eager looking for a solutions :(
Previous Topic:ScaledGraphics
Next Topic:problem with ScaledGraphics
Goto Forum:
  


Current Time: Thu Mar 28 22:04:11 GMT 2024

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

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

Back to the top