I think the diagram model requires UUIDs as supported by XMIResourceImpl
so likely your goal is in conflict with what's going to work. Why do
you even want this?
Have you read about serializing your model is a file separate from the
diagram. Then you can use any resource implementation for the model.
I'm not sure the details, but it's been asked many times so I'm sure a
little searching will turn up the answer for you.

I'm also developing an editor using GMF and I have the same requirement.I have developed my domain model using XML schema and I found following way.

When you run the GMF project, a new instance of Eclipse appears and you have to create a new project using the diagram you developed. When you open that project you can see two files. In my case, they are default.ixml and default.ixml_diagram. Then right click on default.ixml--> open with--> text editor. When it opens I can see my model in XML format.

I understand about the two files for model and diagram, but I wanted to have one file for model and diagram. I was thinking that once I changed type of editor (model and diagram in one file) then all ui specific details are defined in the code (figures, edit parts, etc) rather than in the XMI file. Unless I don't understand completely how this works - I am basing my presumptions on emf/gef duo.

Ed Merks wrote on Sat, 21 May 2011 11:54

I think the diagram model requires UUIDs as supported by XMIResourceImpl
so likely your goal is in conflict with what's going to work. Why do
you even want this?
Have you read about serializing your model is a file separate from the
diagram. Then you can use any resource implementation for the model.
I'm not sure the details, but it's been asked many times so I'm sure a
little searching will turn up the answer for you.

Yes, that's what I have now, but was looking (if possible) to have one model file and code reflecting gmftools, gmfgraph setup. Kind of how emf/gef works. With default gmf implementation you always need two files to make editor work.

pavithra wrote on Sat, 21 May 2011 21:35

Hi,
You asked about how to save the model in XML.

I'm also developing an editor using GMF and I have the same requirement.I have developed my domain model using XML schema and I found following way.

When you run the GMF project, a new instance of Eclipse appears and you have to create a new project using the diagram you developed. When you open that project you can see two files. In my case, they are default.ixml and default.ixml_diagram. Then right click on default.ixml--> open with--> text editor. When it opens I can see my model in XML format.

forums-noreply@eclipse.org wrote:
> I understand about the two files for model and diagram, but I wanted
> to have one file for model and diagram. I was thinking that once I
> changed type of editor (model and diagram in one file) then all ui
> specific details are defined in the code (figures, edit parts, etc)
> rather than in the XMI file.
What do you mean in the code? Clearly the information needs to be
stored in the XML in some form to be recovered when you open the
resource....
> Unless I don't understand completely how this works
I'm not sure I understand what you're expecting. For a diagram to be
computed from scratch each time you open just the model file? You'd
have no control over layout or any other aspect this way...
> - I am basing my presumptions on emf/gef duo.
>
> Ed Merks wrote on Sat, 21 May 2011 11:54
>> I think the diagram model requires UUIDs as supported by
>> XMIResourceImpl so likely your goal is in conflict with what's going
>> to work. Why do you even want this?
>> Have you read about serializing your model is a file separate from
>> the diagram. Then you can use any resource implementation for the
>> model. I'm not sure the details, but it's been asked many times so
>> I'm sure a little searching will turn up the answer for you.
>>
>>
>> forums-noreply@eclipse.org wrote:
>> > No, in gmfgen I set to use one file for diagram and model.
>
>

Ok, I think I understand. GMF generates diagram and model (or just model with diagram in XMI) to create editor. My expectations were when I chose to use one file in gmfgen ("Same file For Diagram And Model") is to have one file defined by "Diagram File Extension", much like what happens in EMF/GEF, where file is the model with EMF parts and GEF counterparts in the code.