Creating a tab button through a script
Typically, you will want to create Scripts within a profile Package.
If you apply a Script to a diagram type, you will not be able to use that diagram type's standard diagram tab with any diagrams of that type. If this is a problem, use a Stereotype to apply the button to specific diagrams. See Creating a toolbar button through a stereotype.
To create a tab button through a script:
1. Right-click the profile Package, and select New > UML > Profiles > Script.
2. Type a name for the Script, and then press the Enter key.
3. Open the Script's Property Pages, and then click the Items tab.
4. Click the Link button, select the diagram types to which you want to apply the customized button, and then click OK.
5. Click the Settings tab.
6. In the Script Type list, select Toolbar Command.
7. In the Command list, select the diagram button on which you want to base the new customized button.
A diagram button is valid only for the diagram type it specifies. Buttons that do not include a diagram name are valid for all diagram types.
If you want only to add a standard button to a customized diagram tab, you can ignore the steps that follow.
8. If you want the customized button to be part of a group of buttons, type the value of the group in the Group box. All buttons that appear on the tab and have the same group value will appear as buttons of the same split button, such as, the Dependency buttons on the Class Diagram tab.
9. In the ToolTip box, type the text of the button's ToolTip. If you want to use the ToolTip of the button on which the customized button is based, leave the ToolTip box blank.
10. In the Status Bar Text box, type the text you want to appear in the status bar when you rest the mouse pointer over the button. If you want to use the status bar text of the button on which the customized button is based, leave the Status Bar Text box blank.
11. If you want the customized button to use an icon that is different from that of the button on which it is based, click the Edit button, and then select the icon you want to use.
12. If you want the customized button to be added to the target diagram's tab buttons, rather than replacing all the target tab’s buttons, select the Additive check box.
13. If you want the customized button to have a separator to its left, select the Separator Before check box.
14. Click the Script tab.
15. In the box, type the script you want to run after the button has been used to add an item to a diagram.
If you want to change the text in a larger window with the Text tab available, click the Editor button.
Write the script within the available functions for a ToolbarCommand script. For more information about working with scripts, see:
16. If you want to group the button with other Script applied buttons and specify which order those buttons appear, see Ordering script applied buttons on a customized diagram toolbar.
The customized button will be used by valid diagrams next time they are opened.