How to Hide Constructors in UML Class Diagrams

This step-by-step guide shows you how to hide constructors in your UML class diagrams. We’ll be focusing on hiding all constructors from the class diagrams.

Step 1: Opening the Filter Options

  • Navigate to the 'Diagram' tab located in the ribbon at the top of the screen.
  • Look for the 'Create New Filter' button within the 'Filter' group and click on it.
  • This action will open the 'Filter Definition' dialog box, where you can define your custom filter.

Step 2: Naming Your Filter

  • In the 'Filter Definition' dialog, you'll be prompted to name your filter.
  • For clarity, name it 'Without Constructors'. This helps in identifying the purpose of the filter later on.

Step 3: Setting Up the Field Filter

  • In the filter settings, select the 'Field filter' option. (This is a crucial step as it ensures that the filter applies only to the fields of the elements and not to the elements themselves.)

Step 4: Adding Filter Alternatives

  • Navigate to the 'Alternatives' group within the dialog and click 'Add'.
  • Here, you will define the specifics of what you want to filter out.
  • In the new dialog that appears, select 'Type' from the dropdown menu on the left.
  • Type 'attribute' in the search box and choose 'Attribute (system type: attribute)' from the list that appears.
  • Ensure to check the 'Negate' checkbox. This is essential as it inverts the filter's logic, allowing the constructors to be hidden.

Step 5: Finalizing the Filter

  • Click 'OK' to add this condition to your filter.
  • Repeat the process by clicking 'Add' again. This time, select 'Stereotype' from the dropdown and type 'create' in the adjacent field.
  • Again, check the 'Negate' checkbox and click 'OK'.
  • You should now see both conditions listed in your filter.

Step 6: Applying the Filter

  • To apply the filter to your current diagram, click the final 'OK' button.
  • Your UML class diagram should now be updated, with all constructors hidden.

Step 7: Managing the Filter

  • If you need to remove the filter, simply click on the 'Remove Filter' button found in the filter bar above the diagram editor.
  • To reapply the filter, go to the 'Filters' dropdown in the 'Filter' group on the 'Diagram' tab and select your 'Without Constructors' filter.

New Comment

Comment