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:
- Rhapsody API
- HEP file
- 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:
- Unzip the contents of the attachment to the location where your rpy is located.
- Open your model and add pmr_profile.sbs to your project as reference.
- Close your model and open it again.
Steps to ensure the program is working as expected:
- Add class A and B on OMD diagram.
- Draw a custom dependency between A and B.
- 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.
![](/support/pages/system/files/support/swg/rattech.nsf/0/f12f6f3c1cf4c6e585257a63000f072c/Content/0.3710.gif)
![](/support/pages/system/files/support/swg/rattech.nsf/0/f12f6f3c1cf4c6e585257a63000f072c/Content/0.45CA.gif)
For more information about how to customize diagram toolbox, see Technote 1506738.
Troubleshooting tips:
- 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).
- 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.
Related Information
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21608919