Topic
  • 3 replies
  • Latest Post - ‏2010-11-24T08:36:05Z by Pettax
Pettax
Pettax
4 Posts

Pinned topic Creating a semantic relationship also creates (unwanted) view

‏2010-08-11T09:09:28Z |
Hi,

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);
enableCanonicalModeCommand.setDomain(UMLModeler.getEditingDomain());
addTransitionCommand.add(new CommandProxy(disableCanonicalModeCommand));
addTransitionCommand.add(new AddTransitionCommand());
addTransitionCommand.add(new CommandProxy(enableCanonicalModeCommand));

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?
Updated on 2010-11-24T08:36:05Z at 2010-11-24T08:36:05Z by Pettax
  • Pettax
    Pettax
    4 Posts

    Re: Creating a semantic relationship also creates (unwanted) view

    ‏2010-08-30T14:38:41Z  
    Note to self:

    invoke

    editPart.removeEditPolicy(EditPolicyRoles.CANONICAL_ROLE);

    on the RegionEditPart.
  • Rowan.Olin
    Rowan.Olin
    1 Post

    Re: Creating a semantic relationship also creates (unwanted) view

    ‏2010-11-20T04:40:55Z  
    Pettax wrote:
    Note to self:

    invoke

    editPart.removeEditPolicy(EditPolicyRoles.CANONICAL_ROLE);

    on the RegionEditPart.

    Why this? Could you give more detailed description? Maybe it's stupid to ask such a question.
  • Pettax
    Pettax
    4 Posts

    Re: Creating a semantic relationship also creates (unwanted) view

    ‏2010-11-24T08:36:05Z  
    Pettax wrote:
    Note to self:

    invoke

    editPart.removeEditPolicy(EditPolicyRoles.CANONICAL_ROLE);

    on the RegionEditPart.

    Why this? Could you give more detailed description? Maybe it's stupid to ask such a question.
    >Could you give more detailed description? Maybe it's stupid to ask such a question.
    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.

    /Pettax