Macromedia dreamweaver 8-extending dreamweaver Benutzerhandbuch

Seite von 504
Components panel API functions
413
getContextMenuId()
Availability
Dreamweaver MX.
Description 
Returns the Context Menu ID for the component type. Every component type can have a 
context menu associated with it. The Context Menu pop-up menus are defined in the 
ComponentNameMenus.xml file, and they work the same way as the menu.xml file. The menu 
string can be static or dynamic. Shortcut keys (accelerator keys) are supported.
Arguments
None.
Returns
A string defining the Context Menu ID.
Example
The following example sets the menu options for the Components panel for web services 
associated with the ASP.NET/C# server model and defines the shortcut keys for that menu:
function getContextMenuId()
{
return "DWWebServicesContext";
}
Where DWWebServicesContext is defined in the file in the Configuration/Components/
ASP.NET_CSharp/WebServices/WebServicesMenus.xml as follows:
<shortcutlist id="DWWebServicesContext">
<shortcut key="Del" domRequired="false" 
enabled="(dw.serverComponentsPalette.getSelectedNode() != null && 
(dw.serverComponentsPalette.getSelectedNode().objectType=='Root'))" 
command="clickedDelete();" id="DWShortcuts_ServerComponent_Delete" />
</shortcutlist>
<menubar name="" id="DWWebServicesContext">
    <menu name="Server Component Popup" id="DWContext_WebServices">
        <menuitem name="Edit Web Service" domRequired="false" 
enabled="dw.serverComponentsPalette.getSelectedNode() != null && 
(dw.serverComponentsPalette.getSelectedNode().objectType=='Root') && 
dw.serverComponentsPalette.getSelectedNode().wsRec != null && 
dw.serverComponentsPalette.getSelectedNode().wsRec.ProxyGeneratorName != 
null" command="editWebService()" 
id="DWContext_WebServices_EditWebService" />
...
</menubar>