I'm using the UMLElementFactory to create a transition between two states in a State machine by invoking the following
UMLElementFactory.createRelationship(container, UMLElementTypes.TRANSITION, source, target, getNullProgressMonitor());
I do not want the transition to be visible in the diagram, i.e. I don't want the notational view to be created. By default the notational view is created as a result of the semantic transition is created. I think this is done by a CanonicalEditPolicy. I've tried to disable the CanonicalEditPolicy by issuing a ToggleCanonicalModeCommand before I make the model change. It works to some extent but not in all cases.
My command looks something like below:
CompositeCommand addTransitionCommand = new CompositeCommand("Add Transition Command");
ToggleCanonicalModeCommand disableCanonicalModeCommand = createToggleCanonicalModeCommand(false);
ToggleCanonicalModeCommand enableCanonicalModeCommand = createToggleCanonicalModeCommand(true);
This command still draws the notational transition. If I exclude the enableCanonicalModeCommand then it works for this particular command but the notational transition keeps popping up in later phases of diagram manipulation. I guess there is another component enabling this policy again. Can anyone point me in the direction on how to implement this properly?
Pinned topic Creating a semantic relationship also creates (unwanted) view
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-11-24T08:36:05Z at 2010-11-24T08:36:05Z by Pettax
Rowan.Olin 270003FYVU1 Post
Re: Creating a semantic relationship also creates (unwanted) view2010-11-20T04:40:55ZThis is the accepted answer. This is the accepted answer.Pettax wrote:
Note to self:
on the RegionEditPart.
Why this? Could you give more detailed description? Maybe it's stupid to ask such a question.
Re: Creating a semantic relationship also creates (unwanted) view2010-11-24T08:36:05ZThis is the accepted answer. This is the accepted answer.
- Rowan.Olin 270003FYVU
The role of the canonical edit policy is to keep the semantic model and the notational model in sync, i.e. to ensure that what you see on the diagram surface corresponds to the state of the semantic model. This is in most cases what you want. There is often a 1-to-1 mapping. In my case however, I want to create semantic elements that should not be visible on the diagram surface. Removing the canonical edit policy removes the automatic syncing that created problems for me. In the final solution I will probably end up with putting it back but only let it synchronize the elements that I want to be in sync and leave the others.
Hope it is clearer now.