ho [message #1747923] |
Wed, 16 November 2016 15:28  |
Eclipse User |
|
|
|
Hi,
I want to change an element with a wizard. I want to swap the selected element to another one in the palette. Im modeling BPMN and I need that start event can change to a message start event with a wizard. I just do not know how to do it. I know I can modify the properties of the element but what if I want to swap the element? Should I connect ewl with java? or there is a ewl code that can do it?
Thanks
Lina
|
|
|
|
Re: ho [message #1748296 is a reply to message #1748008] |
Mon, 21 November 2016 16:28   |
Eclipse User |
|
|
|
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 06:10   |
Eclipse User |
|
|
|
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.06060 seconds