Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » ho(Modify a diagram object with wizard ewl)
ho [message #1747923] Wed, 16 November 2016 20:28 Go to next message
Lainis 20 is currently offline Lainis 20Friend
Messages: 26
Registered: November 2016
Junior Member
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 #1748008 is a reply to message #1747923] Thu, 17 November 2016 16:32 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

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 Go to previous messageGo to next message
Lainis 20 is currently offline Lainis 20Friend
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 #1748400 is a reply to message #1748296] Tue, 22 November 2016 18:57 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Can you produce a minimal example of the sort of thing you can't do and attach it over here, so I can have a try?

https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: ho [message #1748518 is a reply to message #1748400] Wed, 23 November 2016 22:17 Go to previous messageGo to next message
Lainis 20 is currently offline Lainis 20Friend
Messages: 26
Registered: November 2016
Junior Member
Hi Antonio,

Thanks for your reply,
Here is the minimal example.

Epsilon Version 1.3.0.201602270002
Eclipse Luna Service Release 2 (4.4.2)

To reproduce the Mistake:
I attached my project, to get the editor working right clic on test2Composition.ecore -> eugenia -> Generate GMF editor.
The wizard is miWizard.ewl inside the project I attached. The wizard is already attached to the project manifest. I'm trying to change the StartEvent in to a Gateway.
When you run the project as eclipse app you should create the diagram, put a pool, inside a lane, inside the start event. the wizard called startevent delete the element but do not add the gateway.

Thank you so much
  • Attachment: BPMN.zip
    (Size: 360.58KB, Downloaded 100 times)
Re: ho [message #1748619 is a reply to message #1748518] Fri, 25 November 2016 11:10 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

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);

Re: ho [message #1748805 is a reply to message #1748619] Mon, 28 November 2016 20:13 Go to previous messageGo to next message
Lainis 20 is currently offline Lainis 20Friend
Messages: 26
Registered: November 2016
Junior Member
Hi,

I want to add more elements to the bpmn modeler.
It works perfectly. Thank you

Lina
Re: ho [message #1748936 is a reply to message #1748805] Wed, 30 November 2016 09:33 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

You're welcome! I'm not a BPMN expert, but I recall there are extensibility mechanisms in the BPMN file format and the Eclipse BPMN modeler precisely for this. I like Eugenia a lot, but I'm not sure we're the best solution for this particular problem Smile.

See the "Extensibility" section on their homepage, and their wiki:

https://www.eclipse.org/bpmn2-modeler/
https://wiki.eclipse.org/BPMN2-Modeler/ExtensionPoints
Previous Topic:Record change
Next Topic:Running a basic example
Goto Forum:
  


Current Time: Fri Mar 29 06:44:33 GMT 2024

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

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

Back to the top