Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Keeping contents of two nodes synchronized
Keeping contents of two nodes synchronized [message #536295] Thu, 27 May 2010 10:52 Go to next message
Eclipse UserFriend
Hi,

I have two different node types (Node A and Node B) that contain a description (based on a DescriptionCompartmentEditPart). I want the description to be synchronized if I connect the two node types with a connection.

Basically, I would like the description to be stored in one place but be editable from two different nodes. Editing the description of Node A should be reflected in Node B and vice versa.

I'm thinking something like that Node A is the owner of the description and that Node B (when connected) gets a child added somehow that references the description child of Node A. How can I achieve this?

If I in the view factory for one of the node write something like

public class TextExtensionViewFactory extends TextShapeViewFactory {   
   @Override
   protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) {
      super.decorateView(containerView, view, element, semanticHint, index, persisted);
      view.setType(SemanticHints.TEXT_EXTENSION);
      getViewService().createNode(element, view, SemanticHints.DESCRIPTION, ViewUtil.APPEND, persisted, getPreferencesHint());
   }
}


I end up with something close to what I want to achieve. I get two description children on the node that are in sync, i.e. I can edit either one and the other gets updated. The reason for this, I guess, is that the statement

getViewService().createNode(element, view, SemanticHints.DESCRIPTION, ViewUtil.APPEND, persisted, getPreferencesHint());


get executed twice (once in the superclass). So how can I set up the Notation model to achieve something similar across nodes?

Btw, I using GMF Runtime. Nothing is generated.

Thanks,
Pettax
Re: Keeping contents of two nodes synchronized [message #536317 is a reply to message #536295] Thu, 27 May 2010 11:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you can use EOpposite in your EMF model
Re: Keeping contents of two nodes synchronized [message #536371 is a reply to message #536317] Thu, 27 May 2010 16:20 Go to previous message
Eclipse UserFriend
Oh, does this apply if the nodes are only in the notational model, i.e. not in the semantic model? Do you mind providing a short code snippet on how to apply this in GMF Runtime?

Thanks,
Pettax
Previous Topic:Multiple figure types for one Ecore class
Next Topic:How to detect (& notify) that the size of a node has changed
Goto Forum:
  


Current Time: Sat Jul 05 12:00:16 EDT 2025

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

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

Back to the top