|Re: CanonicalEditPolicy vs. Connection Label Edit Parts [message #515129 is a reply to message #514040]
||Wed, 17 February 2010 19:42
| Christoph Wienands
Registered: July 2009
> How does that fit to labels that are attached to connections? They have an
> own EditPart (in contrast to node labels) and the user interface gives
> options to "Delete from Diagram". This action seems to be irreversibel, as
> there is no way to re-create such feature label. Once removed, such
> feature is only accessible via the properties view. If you change it
> there, the label in the diagram will still be deleted. No way to get it
> back. Only workaround is to remove the whole diagram file and and
> re-initialize the diagram from the semantic model.
> So how does this fit to the idea of a perfectly synchronized diagram and
> model? Any way to force such synchronization, e.g. by disabling such
> delete option?
In case you are still struggling with the label issue, here some information
for a potential workaround. Jan Koenlein describes to some extent the
implementation of a semi-canonical behavior at
At the end of the article he refers to an AddConnectionsAction. This action
will register a context menu entry for GMF diagram nodes 'Add Connections'.
The action needs to be registered in the plugin.xml along the lines:
class=" de.itemis.gmf.runtime.extensions.actions.AddConnectionsActio n "
id=" de.itemis.gmf.runtime.extensions.actions.addConnectionsActio n "
label="Add Connections" menubarPath="additions">
So in order to get your diagram label back, you would first have to delete a
connection from the diagram, then you could add it again using 'Add
Connections'. Now, there might be a problem because as long as you use the
default generated by GMF, there will be a CANONICAL_ROLE registered in the
XXXModelEditPart, which disables the 'Delete from diagram' item, which in
turn means you can't remove the link in the first place.
However, maybe that article gives you some more ideas. For example you could
try registering the default XXXModelCanonicalEditPolicy under the
SemiCanonicalDiagramEditPolicy.SEMI_CANONICAL_ROLE instead of the default
CANONICAL_ROLE. Then you'll get the 'Delete from diagram' context menu entry
while still using the default canonical edit policy (I mean trying because
now there could be unintended side effects).
Powered by FUDForum
. Page generated in 0.04691 seconds