toolbarControls()

Availability

Adobe Dreamweaver MX.

Description

Every component type returns a list of toolBarButtonRec objects, which represents the toolbar icons, in left-to-right order. Each toolBarButtonRec object contains the following properties:

Property Name

Description

image

Path to image file

disabledImage

Optional; path to disabled image searches for the toolbar button

pressedImage

Optional; path to pressed image searches for the toolbar button

toolTipText

Tooltip for the toolbar button

toolStyle

Left /right

enabled

JavaScript code that returns a Boolean value (true or false). The enablers are called when the following conditions exist:

  • When the dreamweaver.serverComponents.refresh() function is called
  • When the selection in the tree changes
  • When server model changes
command

The JavaScript code to execute. The command handler can force a refresh using the dreamweaver.serverComponents.refresh() function.

menuId

The unique menu ID for the pop-up menu button when the button is clicked. When this ID is present, it overrides the command handler. In other words, the button can be either a button associated with a command, or a button that has a pop-up menu associated with it, but not both at the same time.

Arguments

None.

Returns

An array of toolbar buttons in left-to-right order.

Example

The following example assigns properties to the toolbar buttons:

function toolbarControls(){ var toolBarBtnArray = new Array(); dom = dw.getDocumentDOM(); var plusButton = new ToolbarControlRec(); var aServerModelName = null; if (dom && dom.serverModel) { aServerModelName = dom.serverModel.getDisplayName(); } else { //look in the site for potential server model aServerModelName = site.getServerDisplayNameForSite(); } if (aServerModelName.length) { if(aServerModelName == "ColdFusion") { plusButton.image = PLUS_BUTTON_UP; plusButton.pressedImage = PLUS_BUTTON_DOWN; plusButton.disabledImage = PLUS_BUTTON_UP; plusButton.toolStyle = "left"; plusButton.toolTipText = MM.MSG_WebServicesAddToolTipText; plusButton.enabled = "dwscripts.IS_WIN"; plusButton.command = "invokeWebService()"; } else { plusButton.image = PLUSDROPBUTTONUP; plusButton.pressedImage = PLUSDROPBUTTONDOWN; plusButton.disabledImage = PLUSDROPBUTTONUP; plusButton.toolStyle = "left"; plusButton.toolTipText = MM.MSG_WebServicesAddToolTipText; plusButton.enabled = "dwscripts.IS_WIN"; plusButton.menuId = "DWWebServicesChoosersContext"; } toolBarBtnArray.push(plusButton); var minusButton = new ToolbarControlRec(); minusButton.image = MINUSBUTTONUP; minusButton.pressedImage = MINUSBUTTONDOWN; minusButton.disabledImage = MINUSBUTTONDISABLED; minusButton.toolStyle = "left"; minusButton.toolTipText = MM.MSG_WebServicesDeleteToolTipText; minusButton.command = "clickedDelete()"; minusButton.enabled = "(dw.serverComponentsPalette.getSelectedNode() != null && dw.serverComponentsPalette.getSelectedNode() && ((dw.serverComponentsPalette.getSelectedNode().objectType=='Root') || (dw.serverComponentsPalette.getSelectedNode().objectType == 'Error') || (dw.serverComponentsPalette.getSelectedNode().objectType == 'MissingProxyGen')))"; toolBarBtnArray.push(minusButton); if(aServerModelName != null && aServerModelName.indexOf(".NET") >= 0) { var deployWServiceButton = new ToolbarControlRec(); deployWServiceButton.image = DEPLOYSUPPORTBUTTONUP; deployWServiceButton.pressedImage = DEPLOYSUPPORTBUTTONDOWN; deployWServiceButton.disabledImage = DEPLOYSUPPORTBUTTONUP; deployWServiceButton.toolStyle = "right"; deployWServiceButton.toolTipText = MM.MSG_WebServicesDeployToolTipText; deployWServiceButton.command = "site.showTestingServerBinDeployDialog()"; deployWServiceButton.enabled = true; toolBarBtnArray.push(deployWServiceButton); } //add the rebuild proxy button for windows only. //bug 45552: if(navigator.platform.charAt(0) !="M") { var proxyButton = new ToolbarControlRec(); proxyButton.image = PROXYBUTTONUP; proxyButton.pressedImage = PROXYBUTTONDOWN; proxyButton.disabledImage = PROXYBUTTONDISABLED; proxyButton.toolStyle = "right"; proxyButton.toolTipText = MM.MSG_WebServicesRegenToolTipText; proxyButton.command = "reGenerateProxy()"; proxyButton.enabled = "enableRegenerateProxyButton()"; toolBarBtnArray.push(proxyButton); } } return toolBarBtnArray;}