Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Error saving resource set
Error saving resource set [message #188225] Wed, 21 May 2008 14:00 Go to next message
Eclipse UserFriend
Originally posted by: cmarbur.iti.upv.es

Hello everybody.

I have to develope an application to modelize some controls of HTML
model which can be only into the "body" tag.

I have build a model with HTML, Head, Body and Div elements.

HTML
+ Head
+ Body
+ Div
+ Div
+ Div

Then I have built the figures and tools files and the maping file in
which root element is Body, because HTML and Head doesn't matter to me
in the editor.

When I build code, I get a class with an error in the method:

private static DocumentRoot createDocumentRoot(Body model) {}

I have corrected it using this code:

private static DocumentRoot createDocumentRoot(Body model) {
HTML html = XHTMLFactory.eINSTANCE.createHTML();
html.setBody(model);

DocumentRoot docRoot = XHTMLFactory.eINSTANCE.createDocumentRoot();
docRoot.setHtml(html);

return docRoot;
}

Now my program runs ok but when I try to save the diagram an error arises:

"Cannot modify resource set without a write transaction"

How can I correct this error? Which is the mistake?

Thanks in advance.
Re: Error saving resource set [message #188313 is a reply to message #188225] Wed, 21 May 2008 16:18 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Carlos,

Put a breakpoint into ???DocumentProvider.doSaveDocument() to see the line
where exception is thrown.

-----------------
Alex Shatalin
Re: Error saving resource set [message #188423 is a reply to message #188225] Thu, 22 May 2008 08:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cmarbur.iti.upv.es

Hi again.

I have notice that my mistake can be other. The model I described
earlier wasn't exactly my model.

First of all, I have a model (X) with controls (A, B, Group, ...) that
will be included in HTML model to rich it. I have done the ecore, model
and diagram code of it to have classes like EditParts which I will use
then in HTML diagram editor.

After this, I'm doing the same with HTML model but including this X
model into it. I'm enhacing the Group so it can contain HTML divs too.
When I build the model code it is implemented in a class that extends Group.

I can make an EMF editor using two models at the same time but when I
create gmf (graph, tool, map, gen) files and generate code, my problem
arises. In the maping file I use "load resource" to include X model
maping file, and then I can add nodes and tools from it. If I include a
control from this model the problem arises but if I only use divs it
doesn't.

I think that this makes the program a litle more complicated. It's not
the same that I explained before.

Does somebody knows how to resolve this problem or how to implement the
inclusion of GMF generated clases of a diagram into another to use them
in the second one.

Thanks in advance.


Carlos Martí­nez Burgos escribió:
> Hello everybody.
>
> I have to develope an application to modelize some controls of HTML
> model which can be only into the "body" tag.
>
> I have build a model with HTML, Head, Body and Div elements.
>
> HTML
> + Head
> + Body
> + Div
> + Div
> + Div
>
> Then I have built the figures and tools files and the maping file in
> which root element is Body, because HTML and Head doesn't matter to me
> in the editor.
>
> When I build code, I get a class with an error in the method:
>
> private static DocumentRoot createDocumentRoot(Body model) {}
>
> I have corrected it using this code:
>
> private static DocumentRoot createDocumentRoot(Body model) {
> HTML html = XHTMLFactory.eINSTANCE.createHTML();
> html.setBody(model);
>
> DocumentRoot docRoot = XHTMLFactory.eINSTANCE.createDocumentRoot();
> docRoot.setHtml(html);
>
> return docRoot;
> }
>
> Now my program runs ok but when I try to save the diagram an error arises:
>
> "Cannot modify resource set without a write transaction"
>
> How can I correct this error? Which is the mistake?
>
> Thanks in advance.
Re: Error saving resource set [message #189067 is a reply to message #188423] Fri, 23 May 2008 11:32 Go to previous message
Eclipse UserFriend
Originally posted by: cmarbur.iti.upv.es

Hello.

I have found the problem but I don't know how to solve it.

Doing a trace of the code I have found that the exception rises when the
namespaces are write to the resource, exactly in the method endSave of
the class XMLSaveImpl, when a notification is dispached (I think) in the
line

xmlnsPrefixMap.put(key, value);

What should I do to avoid this problem. Can I run the save method in a
write transaction? How should I implement this?

Thanks in advance.


Carlos Martí­nez Burgos escribió:
> Hi again.
>
> I have notice that my mistake can be other. The model I described
> earlier wasn't exactly my model.
>
> First of all, I have a model (X) with controls (A, B, Group, ...) that
> will be included in HTML model to rich it. I have done the ecore, model
> and diagram code of it to have classes like EditParts which I will use
> then in HTML diagram editor.
>
> After this, I'm doing the same with HTML model but including this X
> model into it. I'm enhacing the Group so it can contain HTML divs too.
> When I build the model code it is implemented in a class that extends
> Group.
>
> I can make an EMF editor using two models at the same time but when I
> create gmf (graph, tool, map, gen) files and generate code, my problem
> arises. In the maping file I use "load resource" to include X model
> maping file, and then I can add nodes and tools from it. If I include a
> control from this model the problem arises but if I only use divs it
> doesn't.
>
> I think that this makes the program a litle more complicated. It's not
> the same that I explained before.
>
> Does somebody knows how to resolve this problem or how to implement the
> inclusion of GMF generated clases of a diagram into another to use them
> in the second one.
>
> Thanks in advance.
>
>
> Carlos Martí­nez Burgos escribió:
>> Hello everybody.
>>
>> I have to develope an application to modelize some controls of HTML
>> model which can be only into the "body" tag.
>>
>> I have build a model with HTML, Head, Body and Div elements.
>>
>> HTML
>> + Head
>> + Body
>> + Div
>> + Div
>> + Div
>>
>> Then I have built the figures and tools files and the maping file in
>> which root element is Body, because HTML and Head doesn't matter to me
>> in the editor.
>>
>> When I build code, I get a class with an error in the method:
>>
>> private static DocumentRoot createDocumentRoot(Body model) {}
>>
>> I have corrected it using this code:
>>
>> private static DocumentRoot createDocumentRoot(Body model) {
>> HTML html = XHTMLFactory.eINSTANCE.createHTML();
>> html.setBody(model);
>>
>> DocumentRoot docRoot = XHTMLFactory.eINSTANCE.createDocumentRoot();
>> docRoot.setHtml(html);
>>
>> return docRoot;
>> }
>>
>> Now my program runs ok but when I try to save the diagram an error
>> arises:
>>
>> "Cannot modify resource set without a write transaction"
>>
>> How can I correct this error? Which is the mistake?
>>
>> Thanks in advance.
Previous Topic:EmfGmf article rcp question
Next Topic:hide single property attribute
Goto Forum:
  


Current Time: Fri Apr 26 23:15:47 GMT 2024

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

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

Back to the top