diff --git a/packages/navigator/src/browser/navigator-contribution.ts b/packages/navigator/src/browser/navigator-contribution.ts index f4384f8ea3de7..6832f44c1ab95 100644 --- a/packages/navigator/src/browser/navigator-contribution.ts +++ b/packages/navigator/src/browser/navigator-contribution.ts @@ -175,13 +175,17 @@ export class FileNavigatorContribution extends AbstractViewContribution { if (this.workspacePreferences['workspace.supportMultiRootWorkspace']) { - registry.registerMenuAction(NavigatorContextMenu.WORKSPACE, { - commandId: WorkspaceCommands.ADD_FOLDER.id - }); - registry.registerMenuAction(NavigatorContextMenu.WORKSPACE, { - commandId: WorkspaceCommands.REMOVE_FOLDER.id - }); + this.registerAddRemoveFolderActions(registry); } + this.workspacePreferences.onPreferenceChanged(change => { + if (change.preferenceName === 'workspace.supportMultiRootWorkspace') { + if (change.newValue) { + this.registerAddRemoveFolderActions(registry); + } else { + this.unregisterAddRemoveFolderActions(registry); + } + } + }); }); } @@ -266,4 +270,17 @@ export class FileNavigatorContribution extends AbstractViewContribution