IBM Support

How to add a custom <<Usage>> dependency and share it across project teams

Question & Answer


Question

How can you create and add a custom dependency (with a different icon) to the tool box of Object Model Diagram, and make it available across your project teams with IBM Rational Rhapsody?

Cause

By creating and adding a custom <<Usage>> dependency in a profile, you can easily share it across project teams.

Answer

Following techniques are used to achieve the specific requirement:

  1. Rhapsody API
  2. HEP file
  3. Profile and Property modification


Attached is a sample 'CustomDependency' application [CustomDependency.zip]. The attached zip contains a code file [CustomDependency.java], a class file [CustomDependency.class], a helper file [pmr_profile.hep] to initialize the CustomDependency program, a profile file [pmr_profile.sbs], a batch file [CustomDependencyBuild.bat] to build CustomDependency.java and an icon [custom_dep.ico].

Steps to make the sample work for your project:

  1. Unzip the contents of the attachment to the location where your rpy is located.
  2. Open your model and add pmr_profile.sbs to your project as reference.
  3. Close your model and open it again.

Steps to ensure the program is working as expected:

  1. Add class A and B on OMD diagram.


  2. Draw a custom dependency between A and B.


  3. See <<Usage>> stereotype is applied automatically.

Tips: If you want to hide some of predefined icons from the tool box, you can do so by using General::Graphics::ObjectModelDiagramToolbar. This property allows you to set or re-order the tools on the drawing toolbar for object model diagrams. Similar property (e.g ActivityDiagramToolbar) is available for various diagrams.




For more information about how to customize diagram toolbox, see Technote 1506738.




Troubleshooting tips:

  1. If the sample does not work out of box, you may recompile CustomDependency.class using the provided batch file (Change RHP_INST_PATH to where Rhapsody is installed).
  2. Ensure java.exe and javac.exe is installed and recognised by your system. Otherwise, you have to edit provided files to work with your environment.

    Note:
    Rhapsody currently supports only 32 bit JRE.

Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


CustomDependency.zipCustomDependency.zip

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Rational Rhapsody Developer","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.6;7.6.0.1;7.6.1;7.6.1.1;7.6.1.2;7.6.1.3;8.0;8.0.1;8.0.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21608919