explorer - update context keys for workspace related actions

//cc @JacksonKearl @isidorn
This commit is contained in:
Benjamin Pasero 2021-08-17 07:53:01 +02:00
parent 1b72b188f9
commit ac32d7d0a0
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65

View file

@ -21,7 +21,7 @@ import { AutoSaveAfterShortDelayContext } from 'vs/workbench/services/filesConfi
import { ResourceContextKey } from 'vs/workbench/common/resources';
import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService';
import { Schemas } from 'vs/base/common/network';
import { DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, HasWebFileSystemAccess, WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys';
import { DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, WorkbenchStateContext, WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys';
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ActiveEditorCanRevertContext, ActiveEditorContext } from 'vs/workbench/common/editor';
@ -526,7 +526,7 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
id: ADD_ROOT_FOLDER_COMMAND_ID,
title: ADD_ROOT_FOLDER_LABEL
},
when: ExplorerRootContext
when: ContextKeyExpr.and(ExplorerRootContext, ContextKeyExpr.or(EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext.isEqualTo('workspace')))
});
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
@ -536,7 +536,7 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
id: REMOVE_ROOT_FOLDER_COMMAND_ID,
title: REMOVE_ROOT_FOLDER_LABEL
},
when: ContextKeyExpr.and(ExplorerRootContext, ExplorerFolderContext)
when: ContextKeyExpr.and(ExplorerRootContext, ExplorerFolderContext, ContextKeyExpr.and(WorkspaceFolderCountContext.notEqualsTo('0'), ContextKeyExpr.or(EnterMultiRootWorkspaceSupportContext, WorkbenchStateContext.isEqualTo('workspace'))))
});
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {