diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 19fa7345b217c..c051a1d8a0ce2 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -443,8 +443,6 @@ export class CodeMenu { const snippetsSettings = this.createMenuItem(nls.localize({ key: 'miOpenSnippets', comment: ['&& denotes a mnemonic'] }, "User &&Snippets"), 'workbench.action.openSnippets'); const colorThemeSelection = this.createMenuItem(nls.localize({ key: 'miSelectColorTheme', comment: ['&& denotes a mnemonic'] }, "&&Color Theme"), 'workbench.action.selectTheme'); const iconThemeSelection = this.createMenuItem(nls.localize({ key: 'miSelectIconTheme', comment: ['&& denotes a mnemonic'] }, "File &&Icon Theme"), 'workbench.action.selectIconTheme'); - const enableOfflineMode = this.createMenuItem(nls.localize({ key: 'miEnableOfflineMode', comment: ['&& denotes a mnemonic'] }, "Enable Offline Mode"), 'workbench.action.enableOfflineMode'); - const disableOfflineMode = this.createMenuItem(nls.localize({ key: 'miDisableOfflineMode', comment: ['&& denotes a mnemonic'] }, "Disable Offline Mode"), 'workbench.action.disableOfflineMode'); const preferencesMenu = new Menu(); preferencesMenu.append(settings); @@ -456,8 +454,6 @@ export class CodeMenu { preferencesMenu.append(__separator__()); preferencesMenu.append(colorThemeSelection); preferencesMenu.append(iconThemeSelection); - preferencesMenu.append(__separator__()); - preferencesMenu.append(this.configurationService.getValue(offlineModeSetting) === true ? disableOfflineMode : enableOfflineMode); return new MenuItem({ label: this.mnemonicLabel(nls.localize({ key: 'miPreferences', comment: ['&& denotes a mnemonic'] }, "&&Preferences")), submenu: preferencesMenu }); } diff --git a/src/vs/platform/actions/common/offlineMode.ts b/src/vs/platform/actions/common/offlineMode.ts index 3dd85b50a03a4..b3d3e6ba07d80 100644 --- a/src/vs/platform/actions/common/offlineMode.ts +++ b/src/vs/platform/actions/common/offlineMode.ts @@ -10,6 +10,8 @@ import { localize } from 'vs/nls'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { TPromise } from 'vs/base/common/winjs.base'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; +import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; +import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; export const offlineModeSetting = 'workbench.enableOfflineMode'; @@ -83,4 +85,24 @@ export class NotifyUnsupportedFeatureInOfflineMode extends Action { ]); return TPromise.as(null); } -} \ No newline at end of file +} + +MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, { + group: '5_offline', + command: { + id: EnableOfflineMode.ID, + title: localize({ key: 'miEnableOfflineMode', comment: ['&& denotes a mnemonic'] }, "Enable &&Offline Mode") + }, + order: 1, + when: ContextKeyExpr.not('config.' + offlineModeSetting) +}); + +MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, { + group: '5_offline', + command: { + id: DisableOfflineMode.ID, + title: localize({ key: 'miDisableOfflineMode', comment: ['&& denotes a mnemonic'] }, "Disable &&Offline Mode") + }, + order: 1, + when: ContextKeyExpr.has('config.' + offlineModeSetting) +}); \ No newline at end of file