Enterprise Architect version 15.0

download
purchase

enzh-CNcsnlfrdehiiditkoplptruskessv

My Profile

Social Media Channels

facebook  twitter  youtube   linkedin

Friday, 03 September 2010 02:12

Showing Classifier Notes in a custom compartment

Written by
Rate this item
(1 Vote)

This example add-in demonstrates how to define a custom compartment to show the Notes defined by an Element's classifier. For example, an Object Instance will show the notes of the Class that it instantiates.

 

The CS_AddinFramework example project can be used as the basis to implement this functionality. The code snippets attached to this article can be inserted into any working C# add-In.

 

Summary of Code

 

Two broadcast events need to be implemented to define a custom compartment - EA_QueryAvailableCompartments and EA_GetCompartmentData.

 

EA_QueryAvailableCompartments returns the names of the custom compartments to be made available. Multiple compartments can be defined using a comma separated string. Options could be implemented at this level to globally disable display of certain compartments. For a more detailed example, refer to the API documentation for this event.

 

EA_GetCompartmentData handles the compartments defined in EA_QueryAvailableCompartments and defines the data to be inserted in the compartment. This event is called for each element on the diagram and each custom compartment to be handled. If the compartment should not be displayed for the current element, return null.

 

Some basic input checking is included in this example to determine whether the custom compartment is displayed for a given element. The following checks are made:

  • The element has a Classifier ID
  • The referenced Classifier contains some notes
  • The element contains a Tagged Value named named “ShowClassifierNotes” with the value “True” (this helps users of the add-in to prevent breaking the layout of existing diagrams, by giving the user explicit control of the compartment visibility)

 

Example of the resulting compartment in Enterprise Architect:

classifier notes small

Read 4570 times Last modified on Tuesday, 09 April 2013 05:02
sparxsystems

Sparx Systems


99 Albert Street
Creswick,
Victoria
3363
Australia
P: +61 3 5345 1140
F: +61 3 5345 1104
 
Sparx Systems specializes in high performance and scalable visual modeling tools for the planning, design and construction of software intensive systems. A Contributing Member of the Object Management Group (OMG), Sparx Systems is committed to realizing the potential of model-driven development based on open standards. The company’s flagship product, Enterprise Architect, has received numerous accolades since its commercial release in August, 2000. Enterprise Architect is the design tool of choice for over 740,000 registered users worldwide.

community.sparxsystems.com
Login to post comments