This section describes the basic requirements for creating and activating a source control class.
You can use either %Studio.Extension.BaseOpens in a new tab or %Studio.SourceControl.BaseOpens in a new tab to add a source code control menu to Studio. You can add up two menus with 19 menu items each.
Users must have the %Developer role in order to use the Studio source control menus.
The %Studio.Extension.BaseOpens in a new tab 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.
Studio class compilation can use multiple processes. Therefore, do not use properties of %Studio.Extension.BaseOpens in a new tab to pass information from MenuItem to OnBeforeCompile. Instead, use a temporary global.
%Studio.SourceControl.BaseOpens in a new tab is a subclass of %Studio.Extension.BaseOpens in a new tab 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.
To extend InterSystems IRIS, you define a new class that extends one of these classes. As you see in “Activating a Source Control Class,” the Management Portal provides a way to indicate which extension class is currently active in a given namespace. 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.