<@interface name="KitCommands" alias="$ENV"> Extension point for defining kit commands (c) SAP AG 2003-2006. All rights reserved. + # For complete description of command definition see @env:KitCommands!COMMAND_DEF ? * # Represents a property of the command You can assign the 'type' attribute for evaluating the value of the property as a function Example closeStudio #TEXT[XMIT_CMD_FILE_CLOSE] #URL[~skin:icons.close.gif] STANDARD function defineCommand(def) { if (!def) return null; if (typeof def != 'object' || !def.id ) return raiseKitError('Invalid command definition near %where%', STR(def)); if (!isValidId(def.id)) return raiseKitError('Invalid namespace specification of Id:'+ def.id + " in kit :" + _currentPackage); var id = UPPER(def.id); if (id in _kitCommands) return raiseKitError('Command "'+id+'" is already defined'); _kitCommands[id] = def; return def; } <@method name="getCommand"> Returns a specified command object Command Id The requested command object function getCommand(id) { return _kitCommands[UPPER(id)] || null; } <@method name="getCommandsTable"> Returns the complete commands table Table of command objects, indexed by command id Command id's are stored in uppercase. Use @lib:Basic!UPPER macro to convert the command id to uppercase before using it as the index in this table. function getCommandsTable() { return _kitCommands; } <@method name="removeCommand"> Removes a specified command definition The id of the command to remove function removeCommand(id) { delete _kitCommands[UPPER(id)]; } <@method name="redefineCommand" scope="private"> Defines or redefines a command function redefineCommand(def) { if (def) delete _kitCommands[UPPER(def.id)]; return defineCommand(def); } <@method name="parseCommand"> Parses the given command node and returns a string which represents its details Command node to parse function parseCommand(commandNode) { var map = getNodeProps(commandNode); var res = "$ENV.defineCommand(" + __xmlMap2Str(map) + ");"; return res; } <@struct name="COMMAND_DEF"> Represents a %STUDIO% command definition The COMMAND_DEF structure is made of: Name | Type | Description id | QName | Command Id - must be prefixed with namespace e.g. com.sap.mypackage:id signal | @lib:Global!SIGNAL_DEF | Signal to raise when the command is invoked text | String | Command text label icon | String | Command icon's relative url key | String | Shortcut key mnemonic (e.g, Ctrl+S) category | String | The command category (can also be a regular expression)