Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram refresh Problem after reorder elements
Diagram refresh Problem after reorder elements [message #516808] Thu, 25 February 2010 09:23 Go to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: February 2010
Junior Member
Hi,

I have a custom action which perform changes to the EMF model underlying the diagram being edited in my GMF editor (e.g. MoveCommand).
These changes are not immediately reflected on the diagram after the action completes...I have to close/reopen the model in the editor for the updates to be displayed.
In the parent XXXCanonicalEditPolicy, I'm handling the syncronization of semantic elements with the corresponding notation elements.

The following code snippet I'm using to reorder the diagram elements.

@Override
protected void refreshSemantic() {
refreshNotationModel();
super.refreshSemantic();
}


private void refreshNotationModel() {
List<?> children = getSemanticChildrenList();
View parent = ((View) host().getModel());
EList<View> viewChildren = parent.getChildren();
jump: for (int i = 0; i < children.size(); i++) {
Object model = children.get(i);
for (int j = i + 1 ; j < viewChildren.size(); j++) {
View view = viewChildren.get(j);
if (view.getElement() == model) {
if (i + 1 != j ) {
ViewUtil.repositionChildAt(parent, view, i + 1);
continue jump;
}
}
}
}
}

The code above syncronize the diagram contents with the semantic model but somehow it doesn't reflect in the diagram editor(Canvas), might be the refresh problem.

Can you please suggest what I'm doing wrong here? Any help will be greatly appriciated.

Thank You.

Msingh


Re: Diagram refresh Problem after reorder elements [message #517151 is a reply to message #516808] Fri, 26 February 2010 11:49 Go to previous message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,

I think you should consider to override the refreshVisuals method
instead of creating your own.

Regards.

Le 25/02/2010 10:23, sbmukesh@gmail.com a écrit :
> Hi,
>
> I have a custom action which perform changes to the EMF model underlying
> the diagram being edited in my GMF editor (e.g. MoveCommand). These
> changes are not immediately reflected on the diagram after the action
> completes...I have to close/reopen the model in the editor for the
> updates to be displayed.
> In the parent XXXCanonicalEditPolicy, I'm handling the syncronization of
> semantic elements with the corresponding notation elements.
>
> The following code snippet I'm using to reorder the diagram elements.
>
> @Override
> protected void refreshSemantic() {
> refreshNotationModel();
> super.refreshSemantic(); }
>
> private void refreshNotationModel() {
> List<?> children = getSemanticChildrenList();
> View parent = ((View) host().getModel()); EList<View> viewChildren =
> parent.getChildren();
> jump: for (int i = 0; i < children.size(); i++) {
> Object model = children.get(i); for (int j = i + 1 ; j <
> viewChildren.size(); j++) {
> View view = viewChildren.get(j); if (view.getElement() == model) {
> if (i + 1 != j ) {
> ViewUtil.repositionChildAt(parent, view, i + 1); continue jump;
> }
> }
> } } }
>
> The code above syncronize the diagram contents with the semantic model
> but somehow it doesn't reflect in the diagram editor(Canvas), might be
> the refresh problem.
>
> Can you please suggest what I'm doing wrong here? Any help will be
> greatly appriciated.
>
> Thank You.
>
> Msingh
>
>
>
Previous Topic:Usage of abstract classes in link mapping
Next Topic:[Announce] GMF 2.2.2 is available
Goto Forum:
  


Current Time: Sat Sep 26 22:50:07 GMT 2020

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

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

Back to the top