Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Add png as an emf resource?
Add png as an emf resource? [message #675116] Mon, 30 May 2011 11:02 Go to next message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
I have created an ecore model and generated the corresponding code. I have also tested that an instance of the full model can be written to disk and loaded back into my RCP application.

Now I need to add some images resources (typically .png files specified by the user) which must be included when the model is saved/loaded. But I can't seem to find any info on how to use emf resources (ResourceSet) to embed images.

Any hints or links to examples/documentation for this?
(no subject) [message #675214 is a reply to message #675116] Mon, 30 May 2011 15:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26279
Registered: July 2009
Senior Member
Do you want to save the bytes for the image itself or save a reference
to the location of the image file? If the former, you'll need to define
an EDataType that can convert the image to a String and back again. The
latter just involves saving the name of the file...


js wrote:
> I have created an ecore model and generated the corresponding code. I
> have also tested that an instance of the full model can be written to
> disk and loaded back into my RCP application.
>
> Now I need to add some images resources (typically .png files
> specified by the user) which must be included when the model is
> saved/loaded. But I can't seem to find any info on how to use emf
> resources (ResourceSet) to embed images.
>
> Any hints or links to examples/documentation for this?
Re: (no subject) [message #675394 is a reply to message #675214] Tue, 31 May 2011 11:40 Go to previous message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
Does emf offer any image2String - string2Image methods?

I have also tried to look into swt:

    Image image = new Image(display, "C:/sample_image.png");
    ImageData imageData = image.getImageData();
    //imageData.convertToString() ??



Any suggestion for libraries convert to a string before I add it as an resource?
Previous Topic:[EMF Compare] Inverse use of EMF Compare
Next Topic:[EMF.Edit] removeCommand
Goto Forum:
  


Current Time: Thu Dec 18 12:32:16 GMT 2014

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

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