Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] GMF -mindmap example problem
[Teneo] GMF -mindmap example problem [message #64704] Mon, 18 December 2006 16:05 Go to next message
Kirill A. Balod is currently offline Kirill A. BalodFriend
Messages: 30
Registered: July 2009
Member
Hello,
I have tried to repeat a tutorial which is described at
http://www.elver.org/hibernate/gmftutorial/tutorial1.html . And have got
"java.lang.IllegalStateException: Cannot modify resource set without a write
transaction" from the action "Initialize mindmap_diagram diagram file"

Any ideas?

Thanks
Kirill



Exception:

java.lang.IllegalStateException: Cannot modify resource set without a write
transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:295)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:257)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessResourceNotification(TransactionChangeRecorder.java:22 7)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:193)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:230)
at
org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1029)
at
org.eclipse.emf.teneo.resource.StoreResource.addToContent(St oreResource.java:284)
at
org.eclipse.emf.teneo.resource.StoreResource.load(StoreResou rce.java:269)
at
org.eclipse.emf.teneo.resource.StoreResource.getContents(Sto reResource.java:398)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.s etTarget(TransactionChangeRecorder.java:128)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.didAdd(BasicNotifierImpl.java:71)
at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList. java:620)
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 00)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.add(BasicNotifierImpl.java:119)
at
org.eclipse.emf.ecore.change.util.ChangeRecorder.addAdapter( ChangeRecorder.java:697)
at
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChang ed(ChangeRecorder.java:352)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:173)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:230)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatc hNotification(NotifyingListImpl.java:260)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:292)
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 00)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createRe source(ResourceSetImpl.java:411)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandCr eateResource(ResourceSetImpl.java:233)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:384)
at
mindmap.diagram.part.MindmapInitDiagramFileAction.run(Mindma pInitDiagramFileAction.java:117)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)


MindmapInitDiagramFileAction.java :
....
111 TransactionalEditingDomain editingDomain =
GMFEditingDomainFactory.INSTANCE
112 .createEditingDomain();
113 ResourceSet resourceSet = editingDomain.getResourceSet();
114
115 EObject diagramRoot = null;
116 try {
117 Resource resource = resourceSet.getResource(URI
118 .createPlatformResourceURI(mySelectedModelFile
119 .getFullPath().toString(), true), true);
120 diagramRoot = (EObject) resource.getContents().get(0);
....

Configuration:
emf-sdo-xsd-SDK-M200611161441.zip
emft-ocl-SDK-1.0.0.zip
emft-query-SDK-1.0.1.zip
emft-teneo-SDK-I200611290220.zip
emft-transaction-SDK-1.0.1.zip
emft-validation-SDK-1.0.1.zip
GEF-SDK-3.2.1.zip
GMF-sdk-experimental-N20061115.zip
GMF-sdk-N20061115.zip
hibernate-3.2.1.ga.zip
uml2-SDK-2.0.2.zip
Re: [Teneo] GMF -mindmap example problem [message #64776 is a reply to message #64704] Mon, 18 December 2006 21:01 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Yes this is an issue because the HibernateResource sends out notifications when loading content from
the database. This can be disabled by passing the DISABLE_NOTIFY option when loading a resource.
Which is not directly possible in the way the resource is used here (the load action is called
implicitly). I have entered a bugzilla for this and will look at this issue later.

As an intermediate workaround you can replace the part in the try catch (line 117 in
MindmapInitDiagramFileAction.java) with the following code:

Resource res = new HibernateResource(URI
.createPlatformResourceURI(mySelectedModelFile
.getFullPath().toString()));
HashMap options = new HashMap();
options.put(XMLResource.OPTION_DISABLE_NOTIFY, "true");
res.load(options);
resourceSet.getResources().add(res);

// Resource resource = resourceSet.getResource(URI
// .createPlatformResourceURI(mySelectedModelFile
// .getFullPath().toString()), true);
diagramRoot = (EObject) res.getContents().get(0);

Note that the old call to resourceSet.getResource is commented out.

gr. Martin

Kirill A. balod wrote:
> Hello,
> I have tried to repeat a tutorial which is described at
> http://www.elver.org/hibernate/gmftutorial/tutorial1.html . And have got
> "java.lang.IllegalStateException: Cannot modify resource set without a write
> transaction" from the action "Initialize mindmap_diagram diagram file"
>
> Any ideas?
>
> Thanks
> Kirill
>
>
>
> Exception:
>
> java.lang.IllegalStateException: Cannot modify resource set without a write
> transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:295)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:257)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessResourceNotification(TransactionChangeRecorder.java:22 7)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:193)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:230)
> at
> org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1029)
> at
> org.eclipse.emf.teneo.resource.StoreResource.addToContent(St oreResource.java:284)
> at
> org.eclipse.emf.teneo.resource.StoreResource.load(StoreResou rce.java:269)
> at
> org.eclipse.emf.teneo.resource.StoreResource.getContents(Sto reResource.java:398)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.s etTarget(TransactionChangeRecorder.java:128)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.didAdd(BasicNotifierImpl.java:71)
> at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList. java:620)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 00)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.add(BasicNotifierImpl.java:119)
> at
> org.eclipse.emf.ecore.change.util.ChangeRecorder.addAdapter( ChangeRecorder.java:697)
> at
> org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChang ed(ChangeRecorder.java:352)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:173)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:230)
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatc hNotification(NotifyingListImpl.java:260)
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:292)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 00)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createRe source(ResourceSetImpl.java:411)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandCr eateResource(ResourceSetImpl.java:233)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:384)
> at
> mindmap.diagram.part.MindmapInitDiagramFileAction.run(Mindma pInitDiagramFileAction.java:117)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
>
>
> MindmapInitDiagramFileAction.java :
> ....
> 111 TransactionalEditingDomain editingDomain =
> GMFEditingDomainFactory.INSTANCE
> 112 .createEditingDomain();
> 113 ResourceSet resourceSet = editingDomain.getResourceSet();
> 114
> 115 EObject diagramRoot = null;
> 116 try {
> 117 Resource resource = resourceSet.getResource(URI
> 118 .createPlatformResourceURI(mySelectedModelFile
> 119 .getFullPath().toString(), true), true);
> 120 diagramRoot = (EObject) resource.getContents().get(0);
> ....
>
> Configuration:
> emf-sdo-xsd-SDK-M200611161441.zip
> emft-ocl-SDK-1.0.0.zip
> emft-query-SDK-1.0.1.zip
> emft-teneo-SDK-I200611290220.zip
> emft-transaction-SDK-1.0.1.zip
> emft-validation-SDK-1.0.1.zip
> GEF-SDK-3.2.1.zip
> GMF-sdk-experimental-N20061115.zip
> GMF-sdk-N20061115.zip
> hibernate-3.2.1.ga.zip
> uml2-SDK-2.0.2.zip
>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] GMF -mindmap example problem [message #597048 is a reply to message #64704] Mon, 18 December 2006 21:01 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Yes this is an issue because the HibernateResource sends out notifications when loading content from
the database. This can be disabled by passing the DISABLE_NOTIFY option when loading a resource.
Which is not directly possible in the way the resource is used here (the load action is called
implicitly). I have entered a bugzilla for this and will look at this issue later.

As an intermediate workaround you can replace the part in the try catch (line 117 in
MindmapInitDiagramFileAction.java) with the following code:

Resource res = new HibernateResource(URI
.createPlatformResourceURI(mySelectedModelFile
.getFullPath().toString()));
HashMap options = new HashMap();
options.put(XMLResource.OPTION_DISABLE_NOTIFY, "true");
res.load(options);
resourceSet.getResources().add(res);

// Resource resource = resourceSet.getResource(URI
// .createPlatformResourceURI(mySelectedModelFile
// .getFullPath().toString()), true);
diagramRoot = (EObject) res.getContents().get(0);

Note that the old call to resourceSet.getResource is commented out.

gr. Martin

Kirill A. balod wrote:
> Hello,
> I have tried to repeat a tutorial which is described at
> http://www.elver.org/hibernate/gmftutorial/tutorial1.html . And have got
> "java.lang.IllegalStateException: Cannot modify resource set without a write
> transaction" from the action "Initialize mindmap_diagram diagram file"
>
> Any ideas?
>
> Thanks
> Kirill
>
>
>
> Exception:
>
> java.lang.IllegalStateException: Cannot modify resource set without a write
> transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:295)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:257)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessResourceNotification(TransactionChangeRecorder.java:22 7)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:193)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:230)
> at
> org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1029)
> at
> org.eclipse.emf.teneo.resource.StoreResource.addToContent(St oreResource.java:284)
> at
> org.eclipse.emf.teneo.resource.StoreResource.load(StoreResou rce.java:269)
> at
> org.eclipse.emf.teneo.resource.StoreResource.getContents(Sto reResource.java:398)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.s etTarget(TransactionChangeRecorder.java:128)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.didAdd(BasicNotifierImpl.java:71)
> at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList. java:620)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 00)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.add(BasicNotifierImpl.java:119)
> at
> org.eclipse.emf.ecore.change.util.ChangeRecorder.addAdapter( ChangeRecorder.java:697)
> at
> org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChang ed(ChangeRecorder.java:352)
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:173)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:230)
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatc hNotification(NotifyingListImpl.java:260)
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:292)
> at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 00)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createRe source(ResourceSetImpl.java:411)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandCr eateResource(ResourceSetImpl.java:233)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:384)
> at
> mindmap.diagram.part.MindmapInitDiagramFileAction.run(Mindma pInitDiagramFileAction.java:117)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
>
>
> MindmapInitDiagramFileAction.java :
> ....
> 111 TransactionalEditingDomain editingDomain =
> GMFEditingDomainFactory.INSTANCE
> 112 .createEditingDomain();
> 113 ResourceSet resourceSet = editingDomain.getResourceSet();
> 114
> 115 EObject diagramRoot = null;
> 116 try {
> 117 Resource resource = resourceSet.getResource(URI
> 118 .createPlatformResourceURI(mySelectedModelFile
> 119 .getFullPath().toString(), true), true);
> 120 diagramRoot = (EObject) resource.getContents().get(0);
> ....
>
> Configuration:
> emf-sdo-xsd-SDK-M200611161441.zip
> emft-ocl-SDK-1.0.0.zip
> emft-query-SDK-1.0.1.zip
> emft-teneo-SDK-I200611290220.zip
> emft-transaction-SDK-1.0.1.zip
> emft-validation-SDK-1.0.1.zip
> GEF-SDK-3.2.1.zip
> GMF-sdk-experimental-N20061115.zip
> GMF-sdk-N20061115.zip
> hibernate-3.2.1.ga.zip
> uml2-SDK-2.0.2.zip
>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:teneo - Usage of assert
Next Topic:[Teneo] EEnum attributes getting reset after a query
Goto Forum:
  


Current Time: Sat Feb 27 22:55:14 GMT 2021

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

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

Back to the top