55
66import * as nls from 'vs/nls' ;
77import { Registry } from 'vs/platform/registry/common/platform' ;
8- import { ToggleAutoSaveAction , GlobalNewUntitledFileAction , FocusFilesExplorer , GlobalCompareResourcesAction , SaveAllAction , ShowActiveFileInExplorer , CollapseExplorerView , RefreshExplorerView , CompareWithClipboardAction , NEW_FILE_COMMAND_ID , NEW_FILE_LABEL , NEW_FOLDER_COMMAND_ID , NEW_FOLDER_LABEL , TRIGGER_RENAME_LABEL , MOVE_FILE_TO_TRASH_LABEL , COPY_FILE_LABEL , PASTE_FILE_LABEL , FileCopiedContext , renameHandler , moveFileToTrashHandler , copyFileHandler , pasteFileHandler , deleteFileHandler , cutFileHandler , DOWNLOAD_COMMAND_ID , openFilePreserveFocusHandler } from 'vs/workbench/contrib/files/browser/fileActions' ;
8+ import { ToggleAutoSaveAction , GlobalNewUntitledFileAction , FocusFilesExplorer , GlobalCompareResourcesAction , SaveAllAction , ShowActiveFileInExplorer , CollapseExplorerView , RefreshExplorerView , CompareWithClipboardAction , NEW_FILE_COMMAND_ID , NEW_FILE_LABEL , NEW_FOLDER_COMMAND_ID , NEW_FOLDER_LABEL , TRIGGER_RENAME_LABEL , MOVE_FILE_TO_TRASH_LABEL , COPY_FILE_LABEL , PASTE_FILE_LABEL , FileCopiedContext , renameHandler , moveFileToTrashHandler , copyFileHandler , pasteFileHandler , deleteFileHandler , cutFileHandler , DOWNLOAD_COMMAND_ID , openFilePreserveFocusHandler , DOWNLOAD_LABEL } from 'vs/workbench/contrib/files/browser/fileActions' ;
99import { revertLocalChangesCommand , acceptLocalChangesCommand , CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/contrib/files/browser/saveErrorHandler' ;
1010import { SyncActionDescriptor , MenuId , MenuRegistry , ILocalizedString } from 'vs/platform/actions/common/actions' ;
1111import { IWorkbenchActionRegistry , Extensions as ActionExtensions } from 'vs/workbench/common/actions' ;
@@ -14,7 +14,7 @@ import { openWindowCommand, COPY_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID,
1414import { CommandsRegistry , ICommandHandler } from 'vs/platform/commands/common/commands' ;
1515import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
1616import { KeybindingsRegistry , KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
17- import { isMacintosh } from 'vs/base/common/platform' ;
17+ import { isMacintosh , isWeb } from 'vs/base/common/platform' ;
1818import { FilesExplorerFocusCondition , ExplorerRootContext , ExplorerFolderContext , ExplorerResourceNotReadonlyContext , ExplorerResourceCut , IExplorerService , ExplorerResourceMoveableToTrash , ExplorerViewletVisibleContext } from 'vs/workbench/contrib/files/common/files' ;
1919import { ADD_ROOT_FOLDER_COMMAND_ID , ADD_ROOT_FOLDER_LABEL } from 'vs/workbench/browser/actions/workspaceCommands' ;
2020import { CLOSE_SAVED_EDITORS_COMMAND_ID , CLOSE_EDITORS_IN_GROUP_COMMAND_ID , CLOSE_EDITOR_COMMAND_ID , CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands' ;
@@ -23,7 +23,7 @@ import { ResourceContextKey } from 'vs/workbench/common/resources';
2323import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService' ;
2424import { URI } from 'vs/base/common/uri' ;
2525import { Schemas } from 'vs/base/common/network' ;
26- import { IsWebContext , WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys' ;
26+ import { WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys' ;
2727import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
2828import { OpenFileFolderAction , OpenFileAction , OpenFolderAction , OpenWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions' ;
2929import { ActiveEditorIsSaveableContext } from 'vs/workbench/common/editor' ;
@@ -218,7 +218,6 @@ export function appendToCommandPalette(id: string, title: ILocalizedString, cate
218218 } ) ;
219219}
220220
221- const downloadLabel = nls . localize ( 'download' , "Download" ) ;
222221appendToCommandPalette ( COPY_PATH_COMMAND_ID , { value : nls . localize ( 'copyPathOfActive' , "Copy Path of Active File" ) , original : 'Copy Path of Active File' } , category ) ;
223222appendToCommandPalette ( COPY_RELATIVE_PATH_COMMAND_ID , { value : nls . localize ( 'copyRelativePathOfActive' , "Copy Relative Path of Active File" ) , original : 'Copy Relative Path of Active File' } , category ) ;
224223appendToCommandPalette ( SAVE_FILE_COMMAND_ID , { value : SAVE_FILE_LABEL , original : 'Save' } , category ) ;
@@ -231,7 +230,7 @@ appendToCommandPalette(SAVE_FILE_AS_COMMAND_ID, { value: SAVE_FILE_AS_LABEL, ori
231230appendToCommandPalette ( CLOSE_EDITOR_COMMAND_ID , { value : nls . localize ( 'closeEditor' , "Close Editor" ) , original : 'Close Editor' } , { value : nls . localize ( 'view' , "View" ) , original : 'View' } ) ;
232231appendToCommandPalette ( NEW_FILE_COMMAND_ID , { value : NEW_FILE_LABEL , original : 'New File' } , category , WorkspaceFolderCountContext . notEqualsTo ( '0' ) ) ;
233232appendToCommandPalette ( NEW_FOLDER_COMMAND_ID , { value : NEW_FOLDER_LABEL , original : 'New Folder' } , category , WorkspaceFolderCountContext . notEqualsTo ( '0' ) ) ;
234- appendToCommandPalette ( DOWNLOAD_COMMAND_ID , { value : downloadLabel , original : 'Download' } , category , ContextKeyExpr . and ( IsWebContext . toNegated ( ) , ResourceContextKey . Scheme . notEqualsTo ( Schemas . file ) ) ) ;
233+ appendToCommandPalette ( DOWNLOAD_COMMAND_ID , { value : DOWNLOAD_LABEL , original : 'Download' } , category , ContextKeyExpr . and ( ResourceContextKey . Scheme . notEqualsTo ( Schemas . file ) ) ) ;
235234
236235// Menu registration - open editors
237236
@@ -465,15 +464,24 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
465464 when : ExplorerFolderContext
466465} ) ;
467466
468- MenuRegistry . appendMenuItem ( MenuId . ExplorerContext , {
469- group : '5_cutcopypaste' ,
470- order : 30 ,
471- command : {
472- id : DOWNLOAD_COMMAND_ID ,
473- title : downloadLabel ,
474- } ,
475- when : ContextKeyExpr . and ( IsWebContext . toNegated ( ) , ResourceContextKey . Scheme . notEqualsTo ( Schemas . file ) )
476- } ) ;
467+ MenuRegistry . appendMenuItem ( MenuId . ExplorerContext , ( ( ) => {
468+ const downloadMenuItem = {
469+ group : '5_cutcopypaste' ,
470+ order : 30 ,
471+ command : {
472+ id : DOWNLOAD_COMMAND_ID ,
473+ title : DOWNLOAD_LABEL ,
474+ } ,
475+ when : ContextKeyExpr . and ( ResourceContextKey . Scheme . notEqualsTo ( Schemas . file ) )
476+ } ;
477+
478+ // Web: currently not supporting download of folders
479+ if ( isWeb ) {
480+ downloadMenuItem . when = ContextKeyExpr . and ( ResourceContextKey . Scheme . notEqualsTo ( Schemas . file ) , ExplorerFolderContext . toNegated ( ) ) ;
481+ }
482+
483+ return downloadMenuItem ;
484+ } ) ( ) ) ;
477485
478486MenuRegistry . appendMenuItem ( MenuId . ExplorerContext , {
479487 group : '6_copypath' ,
0 commit comments