home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Dreamweaver 3 / Configuration / Menus / MM / Primary_Editor_Dynamic.js < prev    next >
Encoding:
Text File  |  1999-12-01  |  1.2 KB  |  53 lines

  1. // Copyright 1999 Macromedia, Inc. All rights reserved.
  2.  
  3.    function receiveArguments()
  4.    {
  5.       var selItems = site.getSelection();
  6.       if (selItems.length > 1)
  7.       {
  8.           site.open();
  9.         return true;
  10.       }
  11.       else if (dw.constructor.gPrimaryEditorURL != "")
  12.       {
  13.          dw.openWithApp(site.getSelection(), dw.constructor.gPrimaryEditorURL);
  14.          return true;
  15.       }
  16.       else
  17.       {
  18.          site.open();
  19.          return true;
  20.       }
  21.    }
  22.  
  23.    function canAcceptCommand()
  24.    {
  25.       var selItems = site.getSelection();
  26.       if (selItems.length == 0)
  27.           return false;
  28.       else if (selItems.length > 1)
  29.           return site.canOpen();
  30.       else if (DWfile.exists(selItems[0]))
  31.         return (DWfile.getAttributes(selItems[0]) != "D");
  32.       else
  33.         return false;
  34.    }
  35.  
  36.    function setMenuText()
  37.    {
  38.       var selItems = site.getSelection();
  39.       if (selItems.length > 1 || selItems.length == 0)
  40.          return "";
  41.  
  42.     // get the primary external editor for the selected item    
  43.       var primaryEditorArray = dw.getPrimaryExtensionEditor(selItems[0]);
  44.       if (primaryEditorArray.length == 1)
  45.            return MENU_Open;
  46.       else
  47.       {
  48.           dw.constructor.gPrimaryEditorName = primaryEditorArray[0];
  49.           dw.constructor.gPrimaryEditorURL = primaryEditorArray[1];
  50.       return MENU_OpenWith + " " + primaryEditorArray[0];
  51.       }
  52.    }
  53.