|Re: <Xtend> How to delete a UseCase from a list [message #533470 is a reply to message #533387]
||Fri, 14 May 2010 07:32
|| Karsten Thoms
Registered: July 2009
Location: Dortmund, Germany
there are several misconceptions in your code here:
1) .collect(e|e) does not do anything
2) I think you use forAll(), but indeed should use collect(). Although forAll does loop through the collection as well as collect(), forAll will return a boolean when checking that all elements in the collection meet the condition inside. That's not what you are intending here.
3) actorList is a new collection, it is no reference to the set of actors in the model, it just contains them. Calling the deleteActor function will actually remove the actor from actorList, but not from the model.
I think what you really want to achieve is to delete the actor "User" really from the model. To do so you would have to use org.eclipse.emf.ecore.util.EcoreUtil#delete(), which must be called through a Java extension.
Void delete (emf::EObject): org.eclipse.emf.ecore.util.EcoreUtil.delete(org.eclipse.emf.ecore.EObject);
Call this fuction by searching the model for your actor:
Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Powered by FUDForum
. Page generated in 0.03445 seconds