Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » error while saving in generated editor
error while saving in generated editor [message #214719] Wed, 07 January 2009 19:33 Go to next message
Marcin Cylke is currently offline Marcin CylkeFriend
Messages: 61
Registered: July 2009
Member
Hello
I'm having some problems with the correct save behavior in my gmf
generated editor. It only happens if I load some external resources and
use an object from the loaded resource in current diagram. Then, when
saving for the first time I get an exception like below. However after
trying to save again everything is ok. Subsequent saves are ok (no
exception thrown), also when opened again, such file looks as expected.

java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:338)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:300)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:282)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:238)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
at
org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:255)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300)
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 26)
at org.eclipse.emf.common.util.BasicEMap.put(BasicEMap.java:591 )
at
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveIm pl.java:292)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:270)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1120)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:973)
at
com.comit.diagram.deployment.diagram.part.DeploymentDocument Provider.doSaveDocument(DeploymentDocumentProvider.java:612)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$1SaveOperation.execute(AbstractDoc umentProvider.java:596)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$DocumentProviderOperation.run(Abst ractDocumentProvider.java:66)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.executeOperation(AbstractDocumentP rovider.java:530)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.saveDocument(AbstractDocumentProvi der.java:579)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.performSave(DiagramDocumentEditor.java:8 25)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.doSave(DiagramDocumentEditor.java:646)
at org.eclipse.ui.internal.SaveableHelper$1.run(SaveableHelper. java:143)
at org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper. java:266)
at
org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:458)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:366)
at
org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:758)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at
org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:755)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2487)
at
org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:274)
at
org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:253)
at
org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:148)
at org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1350)
at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:3291)
at
org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:3304)
at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:74)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at
org.eclipse.jface.commands.ActionHandler.execute(ActionHandl er.java:119)
at org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
at
org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(ParameterizedCommand.java:508)
at
org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:169)
at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman d(WorkbenchKeyboard.java:472)
at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(Workben chKeyboard.java:824)
at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve nt(WorkbenchKeyboard.java:882)
at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ enceBindings(WorkbenchKeyboard.java:571)
at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(Work benchKeyboard.java:512)
at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter .handleEvent(WorkbenchKeyboard.java:127)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:143 6)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1157)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1182)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1167)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1194 )
at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.ja va:698)
at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control. java:2765)
at
org.eclipse.swt.widgets.Composite.gtk_key_press_event(Compos ite.java:702)
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1543)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4506 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4099 )
at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:57 92)
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1177)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Na tive
Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS. java:1550)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3031)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:386)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)


Could you guys help me with that?

Marcin
Re: error while saving in generated editor [message #214751 is a reply to message #214719] Thu, 08 January 2009 12:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33205
Registered: July 2009
Senior Member
Marcin,

I can explain why it's happening, but it's an old problem and I don't
recall what gets suggested to avoid the issue each time it crops up.
When a document with a DocumentRoot (typically a model based on an XML
Schema) is saved, the namespaces used in the serialized instance are
stored in the XMLNS prefix map of the document root, so that it's in the
same state as when you've loaded exactly the document you just saved so
that subsequent saves will use the same prefix (i.e., so that the
prefixes are stable from save to save, even when the instance changes).
The framework makes the seemingly reasonable assumption that saving is a
read-only operation, but this behavior make assumption invalid. I.e., a
write lock needs to be acquired, not just a read lock...


Marcin Cylke wrote:
> Hello
> I'm having some problems with the correct save behavior in my gmf
> generated editor. It only happens if I load some external resources
> and use an object from the loaded resource in current diagram. Then,
> when saving for the first time I get an exception like below. However
> after trying to save again everything is ok. Subsequent saves are ok
> (no exception thrown), also when opened again, such file looks as
> expected.
>
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:338)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:300)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:282)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:238)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
>
> at
> org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:255)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300)
>
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 26)
> at org.eclipse.emf.common.util.BasicEMap.put(BasicEMap.java:591 )
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveIm pl.java:292)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:270)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1344)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1120)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:973)
>
> at
> com.comit.diagram.deployment.diagram.part.DeploymentDocument Provider.doSaveDocument(DeploymentDocumentProvider.java:612)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$1SaveOperation.execute(AbstractDoc umentProvider.java:596)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$DocumentProviderOperation.run(Abst ractDocumentProvider.java:66)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.executeOperation(AbstractDocumentP rovider.java:530)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.saveDocument(AbstractDocumentProvi der.java:579)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.performSave(DiagramDocumentEditor.java:8 25)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.doSave(DiagramDocumentEditor.java:646)
>
> at
> org.eclipse.ui.internal.SaveableHelper$1.run(SaveableHelper. java:143)
> at
> org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper. java:266)
> at
> org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:458)
>
> at
> org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:366)
> at
> org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:758)
>
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
> at
> org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:755)
>
> at
> org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2487)
> at
> org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:274)
>
> at
> org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:253)
>
> at
> org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:148)
> at
> org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1350)
> at
> org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:3291)
> at
> org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:3304)
> at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:74)
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
> at
> org.eclipse.jface.commands.ActionHandler.execute(ActionHandl er.java:119)
> at
> org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
> at
> org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(ParameterizedCommand.java:508)
>
> at
> org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:169)
>
> at
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman d(WorkbenchKeyboard.java:472)
>
> at
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(Workben chKeyboard.java:824)
>
> at
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve nt(WorkbenchKeyboard.java:882)
>
> at
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ enceBindings(WorkbenchKeyboard.java:571)
>
> at
> org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(Work benchKeyboard.java:512)
>
> at
> org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter .handleEvent(WorkbenchKeyboard.java:127)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Display.filterEvent(Display.java:143 6)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1157)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1182)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1167)
> at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1194 )
> at
> org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.ja va:698)
> at
> org.eclipse.swt.widgets.Control.gtk_key_press_event(Control. java:2765)
> at
> org.eclipse.swt.widgets.Composite.gtk_key_press_event(Compos ite.java:702)
> at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1543)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:4506 )
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4099 )
> at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
> at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:57 92)
> at org.eclipse.swt.widgets.Display.eventProc(Display.java:1177)
> at
> org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Na tive Method)
> at
> org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS. java:1550)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3031)
> at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
>
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:386)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:616)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
>
>
> Could you guys help me with that?
>
> Marcin
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: error while saving in generated editor [message #214776 is a reply to message #214751] Thu, 08 January 2009 12:51 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Ed, Marcin,

Looks like this bug was already described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=211863

-----------------
Alex Shatalin
Re: error while saving in generated editor [message #214866 is a reply to message #214776] Thu, 08 January 2009 20:50 Go to previous message
Marcin Cylke is currently offline Marcin CylkeFriend
Messages: 61
Registered: July 2009
Member
Alex Shatalin wrote:

> Looks like this bug was already described here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=211863

Thank You, this one helped me to solve the problem.

Also, thanks Ed, I haven't a slightest clue about the reason behind this
error.

Bye
Marcin
Previous Topic:Node creation failed
Next Topic:using uml diagram figures
Goto Forum:
  


Current Time: Sun Sep 01 07:25:32 GMT 2024

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

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

Back to the top