Keeping contents of two nodes synchronized [message #536295] |
Thu, 27 May 2010 10:52  |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04575 seconds