Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Refreshing missing edges/connections
Refreshing missing edges/connections [message #143291] Wed, 18 July 2007 15:09
Andrew J. Montalenti is currently offline Andrew J. MontalentiFriend
Messages: 23
Registered: July 2009
Junior Member
Hi all,

I have a GMF generated diagram editor which I've customized to remove the
CanonicalEditPolicy on the element EditPart associated with the canvas.
The main reason I did this was to support a form of "model-diagram
separation", wherein certain elements (which are visualized by top-level
Nodes) of the semantic model can exist in different diagrams. In my
model, I have the following semantic model:

Entity : EClass
- fields : Field

Reference -> Field : EClass
- entityReference : EReference, EReferenceType Entity

In my diagram editor, different subsets of the total Entity set can exist
in different diagrams. The compartment which visualizes Fields has a
CanonicalEditPolicy, to ensure that if Entity "A" exists in more than one
diagram, its fields are always in sync with the semantic model.

So far, so good. I found one situation in which this breaks down --
Edges. I visualize a Reference both as a label in a compartment and as a
Connection on the canvas. However, when drag-and-dropping an Entity with
the following definition:

Entity: name=Account
- Reference: name=User, entityReference=User

on a canvas which already as the Entity User on it, the edge connecting
Account to User is not automatically drawn.

(This seems nominally similar to an issue regarding edge redrawing which
Alex Shatalin has pointed out with shortcuts; my modifications to the
diagram plug-in can be interpreted as the following semantic change: all
"Entities" are shortcuts to the model, just without the "Shortcut"
annotation.)

I've found the code which does the refresh of edges in ???
EditPolicy.refreshConnections(), a private method. I've basically
refashioned this code to be usable without installing the
CanonicalEditPolicy, since installing it would cause things I don't want,
like synchronizing all Entities in the model to the canvas.

This works like a charm. However, currently I'm doing this every time
the EditPart is activated (in a PartListener). Clearly, this is a hack
-- but I was just doing it to test that it works.

What I'm wondering is, where can I actually insert the call to refresh
the connections? I was thinking perhaps a good way to do it would be to
use EditHelperAdvice, and to wrap the operation in a OneTimeCommand. Is
this a good approach? I would be very interested to hear other
approaches. I would need this refresh operation to run in the following
circumstances:

- drag and drop of Entity on the canvas

- moving a Reference from one Entity to another

- a refresh in the semantic children of an Entity already on the
canvas which results in the addition of a Reference field

The first two seem approachable with EditHelperAdvice -- with custom
Create and Move commands. The last, I'm not quite sure (perhaps I need
to modify the CanonicalEditPolicy for the Fields compartment to
automatically refresh the edges somehow?)...

I appreciate any help anyone can offer.

Andrew Montalenti
Previous Topic:one diagram - 2 or more domain model files
Next Topic:Filtering views
Goto Forum:
  


Current Time: Mon Aug 26 02:52:50 GMT 2024

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

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

Back to the top