[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.gmf] Re: Is it possible to create a connection before its source and target elements are created?
|
Hello min,
I suggest you to move code creating MLifeNodes into CreateIncomingNMessage4001Command.doDefaultElementCreation()
method. In this method you can simply call EMF API and forget about TransactionalEditingDomain
+- commands - all this job should be done automatically for you.
So, I suggest you to reimplement doDefaultElementCreation() like this:
NLifeNode firstLifeNode +AD0- NPackageFactory.eINSTANCE.createNLifeNode()+ADs-
NLifeNode secondLifeNode +AD0- NPackageFactory.eINSTANCE.createNLifeNode()+ADs-
getSource().getNLifeNodes.add(firstNode)+ADs-
getTarget().getNLifeNodes.add(secondNode)+ADs-
NMessage message +AD0- NPackageFactory.eINSTANCE.createNMessage()+ADs-
firstLifeNode.getNMessages().add(message)+ADs-
message.setTarget(secondLifeNode)+ADs-
In addition you can create first/secondLifeNodes conditionally here i.e.
use existing NLifeNodes as source/target of the links if corresponding nodes
was already created.
-----------------
Alex Shatalin