Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » XXXDocumentProvider Class DoSave() Method
XXXDocumentProvider Class DoSave() Method [message #1059083] Thu, 16 May 2013 15:07 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

When i write this code to XXXDocumentProviderClass on DoSave() Method;

DiagramImpl di= (DiagramImpl) document.getContent();
		ContentModelImpl cmi = (ContentModelImpl) di.getElement();
		//cmi dolasılır eger her listenin altında default fieldlar yoksa eklenir.
		WebApplicationImpl wa = (WebApplicationImpl) cmi.getOwnedWebApplication();
		EList<SiteCollection> scl =  wa.getOwnedSiteColection();
		for(int z = 0; z<scl.size(); z++){
			SiteCollectionImpl sc = (SiteCollectionImpl) scl.get(z);
			WebImpl rw= (WebImpl) sc.getOwnedWeb();
			//artık burada dolasılır.
			for(int i = 0; i < rw.getOwnedList().size(); i++){
				WebListImpl list = (WebListImpl) rw.getOwnedList().get(i);
				boolean isFound = false;
				for(int j = 0; j < list.getOwnedField().size(); j++){
					FieldImpl f = (FieldImpl) list.getOwnedField().get(j);
						isFound = true;
					TextFieldImpl text= (TextFieldImpl) ContentFactoryImpl.eINSTANCE.createTextField();

i always get Save Failed
"Cannot modify resource set without a write transaction error."

But on save method i must create element so how can i do this anyone can help me ?


[Updated on: Thu, 16 May 2013 15:09]

Report message to a moderator

Re: XXXDocumentProvider Class DoSave() Method [message #1059424 is a reply to message #1059083] Sat, 18 May 2013 08:53 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member

your problem is this line:


You should use a EMF command to achieve you goal. With AddCommand.create() you can create one. As parameters you need to call getEditDomain() on your edit part and as feature you use something like xxxPackage.eInstance.getList_ownedField. The you call getEditDomain().getCommandStack().execute(Command).


[Updated on: Sat, 18 May 2013 08:54]

Report message to a moderator

Previous Topic:Name of deleted Node
Next Topic:Error creating gmfgen file and editor code (GMF Tutorial Cheat Sheet)
Goto Forum:

Current Time: Thu Jun 21 05:10:16 GMT 2018

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

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

Back to the top