Skip to main content

Adding Custom Menus (Source Control or Other)

This page describes briefly how to add custom menus to Studio, so that you can add custom source control options or other customizations.

Basics

To add custom menus to Studio:

  • Define a new class that extends either %Studio.Extension.Base or %Studio.SourceControl.Base; in your subclass, implement callbacks and define the menu options as needed. See the next section.

    You can add up two menus with 19 menu items each.

  • As described in Activating a Source Control ClassOpens in a new tab, use the Management Portal to activate that extension class for the namespace or namespaces where it should work. If an extension class is active in a given namespace, and if that class defines an XDATA menu block, those menu items are added to InterSystems IRIS.

Details

Note:

Users must have the %Developer role in order to use the Studio source control menus.

The %Studio.Extension.Base class provides the following methods, which all use the internal name of the InterSystems IRIS document:

  • Empty Login and Logout methods that you can implement as needed. The variable $username records the current user. (In the Login method, the Username argument is provided for backward compatibility; it is recommended that you use the variable $username instead.)

  • Basic methods to indicate the status of a given InterSystems IRIS document: GetStatus, and IsInSourceControl. Implement these methods as needed.

  • Callback methods that are executed when a user performs some action on an InterSystems IRIS document. These methods include OnBeforeLoad, OnAfterLoad, OnBeforeCompile, OnAfterCompile, ItemIconState.

Note:

Studio class compilation can use multiple processes. Therefore, do not use properties of %Studio.Extension.Base to pass information from MenuItem to OnBeforeCompile. Instead, use a temporary global.

%Studio.SourceControl.Base is a subclass of %Studio.Extension.Base and provides the following additional elements:

  • An XDATA block named Menu that defines an additional menu for InterSystems IRIS: Source Control. By default, this menu contains the menu items Check In, Check Out, Undo Check Out, Get Latest, and Add To Source Control. This XDATA block also defines additional menu items for the context menu in Studio.

    All these menu items call methods also defined in this class.

  • Methods named CheckIn(), CheckOut(), UndoCheckOut(), GetLatest(), and AddToSourceControl(), which do nothing by default.

See Also

FeedbackOpens in a new tab