Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Question on refreshing relations
Question on refreshing relations [message #1039440] Fri, 12 April 2013 07:08 Go to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Hello,

I have created the following diagram on an editor, it should be fairly self-explanatory. Links to the DataType Parts (String, in this case) are hidden but technically exist.
So if I change the name of the Datatype (i.e. String to String_), the actual properties of the elements of that Datatype are renewed, however the diagram itself doesn't refresh and still shows "[attribute] : String", not "[attribute] : String_".
However, if I close and reopen the file containing the diagram, attributes are shown correctly.

I've looked around on where I have to call what kind of refresh here, but I am kind of at a loss.
  • Attachment: model.png
    (Size: 7.42KB, Downloaded 67 times)
Re: Question on refreshing relations [message #1039513 is a reply to message #1039440] Fri, 12 April 2013 08:49 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Well I got it solved by getting the WrappedLabelEditPart which does that refresh from the DatatypeEditPart. But it's not pretty and involves lots of nested for-Loops, so I'm open to other ideas.

Edit:
The recursive version isn't pretty either, so do I have to go about this this way?

[Updated on: Fri, 12 April 2013 11:09]

Report message to a moderator

Re: Question on refreshing relations [message #1039738 is a reply to message #1039513] Fri, 12 April 2013 14:23 Go to previous messageGo to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 55
Registered: February 2013
Member
Hi Claudio,

if everything is setup correctly, GMF (resp. EMF) should propagate the domain changes and refresh the editparts accordingly.
What kind of mappings are you using for your labels, displaying the relation to the Datatype und how are they setup?

Regards
Thomas
Re: Question on refreshing relations [message #1041500 is a reply to message #1039738] Mon, 15 April 2013 07:18 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Hello Thomas,

thank you for your answer.
What I did was basically using a Value Expression for Datatypes and Features to show them in the form [Feature] : [Dtype].
Additionally, to not show the relational lines, I edited the XXXDiagramUpdater to not include those relations on refresh, that is working as designed.
However, if I update the name of a Datatype (or Entity for that matter) itself, the Expression showing the feature is not refreshed.

And the solution I got now, fiddling around in the EditParts manually, doesn't seem too update-proof to me.
Re: Question on refreshing relations [message #1041642 is a reply to message #1041500] Mon, 15 April 2013 11:09 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

did you call refresh by hand on the source and target edit parts to which the view of the relation is connected to? That should help.

Ralph
Re: Question on refreshing relations [message #1041652 is a reply to message #1041642] Mon, 15 April 2013 11:22 Go to previous message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Well what I do now is calling the refresh from the DatatypeNameEditPart and the EntityNameEditPart respectively.
For that I have to move through the EditPart hierarchy to find the corresponding WrappingLabelEditPart and call its refresh method.

Code called in the respective handleNotificationEvent methods via refreshLabels(this.getRoot()):
	private void refreshLabels(EditPart ePart) {
		if (ePart instanceof WrappingLabelEditPart) {
			((WrappingLabelEditPart) ePart).refreshLabel();
			return;
		}
		if (ePart.getChildren()==null) return;
		else
			for (Object child : ePart.getChildren())
				refreshLabels((EditPart) child);
	}


This does work as I want it to but I fear that this is firstly inefficient and secondly, as the handleNotificationEvent methods are also generated, might have to be redone after every nontrivial change.

I am also still wondering why that label refresh is not called by default on F5?

[Updated on: Mon, 15 April 2013 11:34]

Report message to a moderator

Previous Topic:Create elements programatically
Next Topic:Alter the location and the background color of EditPar
Goto Forum:
  


Current Time: Fri Nov 28 15:01:19 GMT 2014

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

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