|
Re: ho [message #1748008 is a reply to message #1747923] |
Thu, 17 November 2016 16:32 |
|
You could define an EWL wizard that creates an instance of the new type, copies over any information and links from the old instance and then deletes the old one. EMF doesn't allow you to simply "retype" an object.
Have a look at the docs and let us know how it goes:
https://www.eclipse.org/epsilon/doc/ewl/
The main challenge you may have is actually updating the BPMN diagram to reflect these changes - that might require some research on your part, as it depends on how the BPMN editor is implemented. Not sure how hard it would be.
|
|
|
Re: ho [message #1748296 is a reply to message #1748008] |
Mon, 21 November 2016 21:28 |
Lainis 20 Messages: 26 Registered: November 2016 |
Junior Member |
|
|
Hi, thanks for answer.
I have been doing research on the material. I figured out how to create an instance, how to delete an element from the canvas, but I do not know how to add it to the diagram. I try with this code:
wizard startMessage{
guard : self.isKindOf(StartEvent)
title : "Start Message"
do{
var i : new StartEvent;
i.ElementName = 'test';
self.println("1"+i);
self.println("2"+Bpmn_diagram!MacroProcess.all);
Bpmn_diagram!MacroProcess.all.first.pools.lanes.add(i);
self.println("3"+Bpmn_diagram!MacroProcess.all);
delete(self);
self.println("4"+Bpmn_diagram!MacroProcess.all);
self.println("5self"+self+"type");
}
}
but i got this(like var i is not inside the diagram) :
1StartEvent [elementName=test, elementDescription=null, eventType=null]StartEvent [elementName=null, elementDescription=null, eventType=null]
2Sequence {MacroProcess []}StartEvent [elementName=null, elementDescription=null, eventType=null]
3Sequence {MacroProcess []}StartEvent [elementName=null, elementDescription=null, eventType=null]
4Sequence {MacroProcess []}StartEvent [elementName=null, elementDescription=null, eventType=null]
5selfStartEvent [elementName=null, elementDescription=null, eventType=null]typeStartEvent [elementName=null, elementDescription=null, eventType=null]
My metamodel:
MacroProcess has pools, Pool has lanes, Lane has ProcessElements and StartEvent is one of them.
Thanks for your help
|
|
|
|
|
Re: ho [message #1748619 is a reply to message #1748518] |
Fri, 25 November 2016 11:10 |
|
Just wondering - why do you reimplement the BPMN metamodel yourself, rather than use the Eclipse BPMN2 Modeler?
https://www.eclipse.org/bpmn2-modeler/
In any case, the problem with your EWL code is that you were doing this:
Bpmn_diagram!MacroProcess.all.first.pools.lanes.add(i);
That doesn't work: up to .lanes, you're computing a collection of the collections of lanes held by each pool in the first MacroProcess, and then trying to add an element to it, which has no real effect on the model. Instead, you want to add the event to the elements of the first lane of the first pool of the first MacroProcess:
Bpmn_diagram!MacroProcess.all.first.pools.first.lanes.first.elements.add(i);
However, I wouldn't personally do this either, as it will only work if the element happens to be in that first lane of the first pool of the first MacroProcess. It's much better to go to the container Lane for that process element (which may be in any Pool) and access its elements, like this:
self.eContainer.elements.add(i);
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04502 seconds