Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to display the referenced element of a connection as a label in GMF
How to display the referenced element of a connection as a label in GMF [message #1720303] Sat, 16 January 2016 13:52 Go to next message
AHOT Mising name is currently offline AHOT Mising nameFriend
Messages: 13
Registered: September 2011
Junior Member
Hi,
I would like to clarify my question with the small metamodel shown in the attached image.
I am trying to create a graphical editor for something like this.
I intend to represent the states as nodes and the transitions as connections between the state nodes.
My problem is how to display the computations (Expressions) as labels on the transition connections. Normally, if the expressions were attributes of the Transition class, I know how to do it as it is explicitly supported in the GMF workflow; however, since the expressions are described in a separate Class that is merely referenced by the Transition class.
Could someone help me out?
Thanks in advance.
index.php/fa/24666/0/
Re: How to display the referenced element of a connection as a label in GMF [message #1721164 is a reply to message #1720303] Mon, 25 January 2016 11:39 Go to previous messageGo to next message
Ángel Moreno is currently offline Ángel MorenoFriend
Messages: 14
Registered: November 2013
Location: Madrid
Junior Member
Hi AHOT,

In complex cases as it, I usually modify the underlying Java code of the Connection EditPart implied in the problem (in your case, the Transition EClass).

From your Java code you can access to the underliying model and modify the text of the Label associated with the Transition Connection, in base of the info associated with the Expression EObject instances.

To do this task, in your Transition EditPart, inside of your createContents() method or other one method, you can access to your underliying model using this lines of code.
	        EObject _eobject = ((View) this.getModel()).getElement();
	        if (_eobject instanceof Transition)
		{
	        	        Transition transitionEObject = (Transition) _eobject;
                                List<Expression> computationsList = transitionEObject.getComputations();
                                // TO-DO. Modify the code and text of the Label associated with the connection
	        }


Maybe, other posible solution it's using the OCL language, to predefine the label text in base of the Transition Expression EObjects, but I can't offer a correct solution in this way.

Regards,
Ángel M.



Ángel Moreno Pérez
Enterprise Architect
El Corte Inglés, Madrid, Spain

[Updated on: Mon, 25 January 2016 11:40]

Report message to a moderator

Re: How to display the referenced element of a connection as a label in GMF [message #1723013 is a reply to message #1721164] Wed, 10 February 2016 20:07 Go to previous message
AHOT Mising name is currently offline AHOT Mising nameFriend
Messages: 13
Registered: September 2011
Junior Member
Hi Ángel,
I'm sorry for the late response, I have been away for a while.
Thanks for your response, let me try it out and I'll get back to you if I have more questions.
Previous Topic:removing GMF toolbar
Next Topic:Extending an editor
Goto Forum:
  


Current Time: Fri Apr 26 06:00:56 GMT 2024

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

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

Back to the top