none
How do I remove UML dependency multiplicity notation from class diagram? RRS feed

  • Question

  • Hi,

    I would like to remove all multiplicity notation from my uml class diagram connection arrows. How is this done?

    Tuesday, July 6, 2010 9:08 AM

Answers

  • You can set the multiplicity to a space " " - that makes it vanish. So you could do those by hand - but that's probably not what you want!

    There isn't really a customization point for this, so you can't properly remove the display of the multiplicity.

    However, you could write a command that goes around all the associations in the model, setting the bounds of each end to " ".

    To be rather cunning you could put the update into a validation method that triggers on save. Create a UML validation project as described in http://msdn.microsoft.com/library/ee329482.aspx and then set the code content to this:

    using System.ComponentModel.Composition;
    using Microsoft.VisualStudio.Modeling.Validation;
    using Microsoft.VisualStudio.Uml.Classes;
    using Microsoft.VisualStudio.ArchitectureTools.Extensibility.Uml;
    
    namespace RemoveMultiplicity
    {
     // See http://msdn.microsoft.com/library/ee329482.aspx
     public class ValidationConstraints
     {
     [Export(typeof(System.Action<ValidationContext, object>))]
     [ValidationMethod(ValidationCategories.Save)]
     public void ValidateSomething(ValidationContext context, IAssociation elementToValidate)
     {
      foreach (IProperty end in elementToValidate.OwnedEnds)
      {
      if (end.LowerValue == null)
       end.SetBounds(" ");
      }
     }
     }
    }
    

    BTW, if you get an error when you press F5, right-click the VSIX project in solution explorer and click Properties. Then in the project editor, click the Debug tab. If "Start External program" just contains "devenv.exe", set it to the full path - usually C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.

    To debug, press F5 and in the experimental VS, open a modeling project.

    To install permanently, go into bin\Debug and double click the .vsix file.

     


    - Alan -MSFT
    Wednesday, July 7, 2010 11:30 PM