| 
| error while saving in generated editor [message #214719] | Wed, 07 January 2009 14:33  |  | 
| Eclipse User  |  |  |  |  | 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 07:29   |  | 
| Eclipse User  |  |  |  |  | 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
 >
 |  |  |  | 
|  | 
|  | 
Powered by 
FUDForum. Page generated in 0.03666 seconds