Customizing Dreamweaver > About customizing Dreamweaver menus > About menus.xml tag syntax

 

About menus.xml tag syntax

The menus.xml file contains a structured list of menu bars, menus, menu items, separators, shortcut lists, and keyboard shortcuts. These items are described by XML tags which you can edit in a text editor.

Note: Be careful when making changes to menus. Dreamweaver ignores any menu or menu item that contains an XML syntax error.

A menu bar (tagged with opening and closing menubar tags) is a discrete menu or set of menus—for example, there's a main menu bar, a separate Site window menu bar (which appears only in Windows, not on the Macintosh), and a menu bar for each context menu. Each menu bar contains one or more menus; a menu is contained in a menu tag. Each menu contains one or more menu items, each described by a menuitem tag and its attributes. A menu can also contain separators (described by separator tags) and submenus.

In addition to the keyboard shortcuts associated with menu items, Dreamweaver provides a variety of other keyboard shortcuts, including alternate shortcuts and shortcuts that are available only in certain contexts. For example, Control+Y (Windows) or Command+Y (Macintosh) is the shortcut for Redo; but Control+Shift+Z or Command+Shift+Z is an alternate shortcut for Redo. These alternates—and other shortcuts that can't be represented in the tags for menu items—are defined in shortcut lists in the menus.xml file. Each shortcut list (described by a shortcutlist tag) contains one or more shortcuts, each described by a shortcut tag.

The following sections describe the syntax of the menus.xml tags. Optional attributes are marked in the attribute lists with braces ({}); all attributes not marked with braces are required.


 
<menubar>

Description

Provides information about a menu bar in the Dreamweaver menu structure.

Attributes

name, {app}, id, {platform}

name The name of the menu bar. Although name is a required attribute, you can give it the value "".

app The name of the application in which the menu bar is available. Valid values are "dreamweaver" and "ultradev". The default is for the menu bar to be available in both Dreamweaver and UltraDev.

id The menu ID for the menu bar. Each menu ID in the menus.xml file should be unique.

platform Indicates that the menu bar should appear only on the given platform. Valid values are "win" and "mac".

Contents

This tag must contain one or more menu tags.

Container

None.

Example

The main (Document window) menu bar uses the following menubar tag:

<menubar name="Main Window" id="DWMainWindow">
	<!-- menu tags here -->
</menubar>


 
<menu>

Description

Provides information about a menu or submenu to appear in Dreamweaver's menu structure.

Attributes

name, {app}, id, {platform}

name The name of the menu as it will appear in the menu bar. To set the menu's access key (mnemonic) in Windows, use an underscore (_) before the access letter. The underscore is automatically removed on the Macintosh.

app The name of the application in which the menu is available. Valid values are "dreamweaver" and "ultradev". The default is for the menu to be available in both Dreamweaver and UltraDev.

id The menu ID for the menu. Every ID in the file should be unique.

platform Indicates that the menu should appear only on the given platform. Valid values are "win" and "mac".

Contents

This tag can contain one or more menuitem tags, and one or more separator tags. It can also contain other menu tags (to create submenus) and standard HTML comment tags.

Container

This tag must be contained in a menubar tag.

Example

<menu name="_File" id="DWMenu_File">
	<!-- menuitem, separator, menu, and comment tags here -->
</menu>


 
<menuitem>

Description

Defines a menu item for a Dreamweaver menu.

Attributes

name, id, {app}, {key}, {platform}, {enabled}, {arguments}, {command}, {file}, {checked}, {dynamic}

name The menu item name that appears in the menu. An underscore indicates that the following letter is the command's access key (mnemonic), for Windows only.

id Used by Dreamweaver to identify the item. This ID must be unique throughout the menu structure. If you add new menu items to menus.xml, ensure uniqueness by using your company name or another unique string as a prefix for each menu item's ID.

app The name of the application in which the menu item is available. Valid values are "dreamweaver" and "ultradev". The default is for the menu item to be available in both Dreamweaver and UltraDev.

key The keyboard shortcut for the command, if any. Use the following strings to specify modifier keys:

Cmd specifies the Control key (Windows) or Command key (Macintosh).
Alt and Opt interchangeably specify the Alt key (Windows) or Option key (Macintosh).
Shift specifies the Shift key on both platforms.
Ctrl specifies the Control key on both platforms.
A plus (+) sign separates modifier keys if a given shortcut uses more than one modifier. For example, Cmd+Opt+5 in the key attribute means the menu item is executed when the user presses Control+Alt+5 (Windows) or Command+Option+5 (Macintosh).
Special keys are specified by name: F1 through F12, PgDn, PgUp, Home, End, Ins, Del, Tab, Esc, BkSp, and Space. Modifier keys can also be applied to special keys.

platform Indicates which platform the item appears on. Valid values are "win", meaning Windows-only, or "mac", meaning Macintosh-only. If you don't specify the platform attribute, the menu item appears on both platforms. If you want a menu item to behave differently on different platforms, supply two menu items with the same name (but different IDs): one with platform="win" and the other with platform="mac".

enabled Provides JavaScript code (usually a JavaScript function call) that determines whether the menu item is currently enabled. If the function returns false, the menu item is dimmed. The default value is "true", but it's best to always specify a value for clarity even if the value is "true".

arguments Provides arguments for Dreamweaver to pass to the code in the JavaScript file that you specify in the file attribute. Enclose arguments in single quotation marks ('), inside the double quotation marks used to delimit an attribute's value.

command Specifies a JavaScript expression that's executed when the user selects this item from the menu. For complex JavaScript code, use a JavaScript file (specified in the file attribute) instead. You must specify either file or command for each menu item.

file The name of an HTML file containing JavaScript that controls the menu item. Specify a path to the file relative to the Configuration folder. (For example, the Help > Welcome menu item specifies file="Commands/Welcome.htm".) Note that the file attribute overrides the command, enabled, and checked attributes. You must specify either file or command for each menu item. For information on creating a command file using the History panel, see Creating new commands from history steps. For information on writing your own JavaScript commands from scratch, see Extending Dreamweaver.

checked A JavaScript expression that indicates whether the menu item has a check mark next to it in the menu; if the expression evaluates as true, the item is displayed with a check mark.

dynamic If present, indicates that a menu item is to be determined dynamically, by an HTML file; the file contains JavaScript code to set the text and state of the menu item. If you specify a tag as dynamic, you must also specify a file attribute.

isdomrequired Indicates whether to synchronize the Design view and the Code view before executing the code for this menu item. Valid values are "true" (the default) and "false". If you set this attribute to "false", it means that the changes to the file that this menu item makes do not use the Dreamweaver DOM. (For information about the DOM, see Extending Dreamweaver.)

Contents

None (empty tag).

Container

This tag must be contained in a menu tag.

Example

<menuitem name="_New" key="Cmd+N" enabled="true" 
command="dw.createDocument()" id="DWMenu_File_New" />


 
<separator>

Description

Indicates that a separator should be displayed at the corresponding location in the menu.

Attributes

{app}

app The name of the application in which the separator is shown. Valid values are "dreamweaver" and "ultradev". The default is for the separator to be shown in both Dreamweaver and UltraDev.

Contents

None (empty tag).

Container

This tag must be contained in a menu tag.

Example

<separator />


 
<shortcutlist>

Description

Specifies a shortcut list in the menus.xml file.

Attributes

{app}, id, {platform}

app The name of the application in which the shortcut list is available. Valid values are "dreamweaver" and "ultradev". The default is for the shortcut list to be available in both Dreamweaver and UltraDev.

id The ID for the shortcut list. It should be the same as the menu ID for the menu bar (or context menu) in Dreamweaver that the shortcuts are associated with. Valid values are "DWMainWindow", "DWMainSite", "DWTimelineContext", and "DWHTMLContext".

platform Indicates that the shortcut list should appear only on the given platform. Valid values are "win" and "mac".

Contents

This tag can contain one or more shortcut tags. It can also contain one or more comment tags (which use the same syntax as HTML comment tags).

Container

None.

Example

<shortcutlist id="DWMainWindow">
	<!-- shortcut and comment tags here -->
</shortcutlist>


 
<shortcut>

Description

Specifies a keyboard shortcut in the menus.xml file.

Attributes

key, {app}, {platform}, {file}, {arguments}, {command}, id, {name}

key The key combination that activates the keyboard shortcut. For syntax details, see <menuitem>.

app The name of the application in which the shortcut is available. Valid values are "dreamweaver" and "ultradev". The default is for the shortcut to be available in both Dreamweaver and UltraDev.

platform Specifies that the shortcut works only on the indicated platform. Valid values are "win" and "mac". If you do not specify this attribute, the shortcut works on both platforms.

file The path to a file containing the JavaScript code that Dreamweaver executes when you use the keyboard shortcut. The file attribute overrides the command attribute. You must specify either file or command for each shortcut.

arguments Provides arguments for Dreamweaver to pass to the code in the JavaScript file that you specify in the file attribute. Enclose arguments in single quotation marks ('), inside the double quotation marks used to delimit an attribute's value.

command The JavaScript code that Dreamweaver executes when you use the keyboard shortcut. Specify either file or command for each shortcut.

id A unique identifier for a shortcut.

name A name for the command executed by the keyboard shortcut, in the style of a menu item name. For example, the name attribute for the F12 shortcut is "Preview in Primary Browser".

Contents

None (empty tag).

Container

This tag must be contained in a shortcutlist tag.

Example

<shortcut key="Cmd+Shift+Z" file="Menus/MM/Edit_Clipboard.htm" 
arguments="'redo'" id="DWShortcuts_Edit_Redo" />