提交 a2fd5725 编写于 作者: B Benjamin Pasero

manager => service

上级 747ae8bf
......@@ -27,7 +27,7 @@ export class LinuxAutoUpdaterImpl extends EventEmitter {
constructor(
@IEnvironmentService private envService: IEnvironmentService,
@ISettingsService private settingsManager: ISettingsService
@ISettingsService private settingsService: ISettingsService
) {
super();
......@@ -50,8 +50,8 @@ export class LinuxAutoUpdaterImpl extends EventEmitter {
this.emit('checking-for-update');
const proxyUrl = this.settingsManager.getValue('http.proxy');
const strictSSL = this.settingsManager.getValue('http.proxyStrictSSL', true);
const proxyUrl = this.settingsService.getValue('http.proxy');
const strictSSL = this.settingsService.getValue('http.proxyStrictSSL', true);
const agent = getProxyAgent(this.url, { proxyUrl, strictSSL });
this.currentRequest = json<IUpdate>({ url: this.url, agent })
......
......@@ -36,7 +36,7 @@ export class Win32AutoUpdaterImpl extends EventEmitter {
constructor(
@ILifecycleService private lifecycleService: ILifecycleService,
@IEnvironmentService private envService: IEnvironmentService,
@ISettingsService private settingsManager: ISettingsService
@ISettingsService private settingsService: ISettingsService
) {
super();
......@@ -64,8 +64,8 @@ export class Win32AutoUpdaterImpl extends EventEmitter {
this.emit('checking-for-update');
const proxyUrl = this.settingsManager.getValue('http.proxy');
const strictSSL = this.settingsManager.getValue('http.proxyStrictSSL', true);
const proxyUrl = this.settingsService.getValue('http.proxy');
const strictSSL = this.settingsService.getValue('http.proxyStrictSSL', true);
const agent = getProxyAgent(this.url, { proxyUrl, strictSSL });
this.currentRequest = json<IUpdate>({ url: this.url, agent })
......@@ -118,7 +118,7 @@ export class Win32AutoUpdaterImpl extends EventEmitter {
}
private getUpdatePackagePath(version: string): TPromise<string> {
return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${ this.envService.quality }-${ version }.exe`));
return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${this.envService.quality}-${version}.exe`));
}
private quitAndUpdate(updatePackagePath: string): void {
......@@ -135,7 +135,7 @@ export class Win32AutoUpdaterImpl extends EventEmitter {
}
private cleanup(exceptVersion: string = null): Promise {
const filter = exceptVersion ? one => !(new RegExp(`${ this.envService.quality }-${ exceptVersion }\\.exe$`).test(one)) : () => true;
const filter = exceptVersion ? one => !(new RegExp(`${this.envService.quality}-${exceptVersion}\\.exe$`).test(one)) : () => true;
return this.cachePath
.then(cachePath => pfs.readdir(cachePath)
......
......@@ -45,22 +45,22 @@ export class LaunchService implements ILaunchService {
constructor(
@ILogService private logService: ILogService,
@IWindowsService private windowsManager: IWindowsService
@IWindowsService private windowsService: IWindowsService
) {}
start(args: ICommandLineArguments, userEnv: IProcessEnvironment): TPromise<void> {
this.logService.log('Received data from other instance', args);
// Otherwise handle in windows manager
// Otherwise handle in windows service
let usedWindows: VSCodeWindow[];
if (!!args.extensionDevelopmentPath) {
this.windowsManager.openPluginDevelopmentHostWindow({ cli: args, userEnv: userEnv });
this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv: userEnv });
} else if (args.pathArguments.length === 0 && args.openNewWindow) {
usedWindows = this.windowsManager.open({ cli: args, userEnv: userEnv, forceNewWindow: true, forceEmpty: true });
usedWindows = this.windowsService.open({ cli: args, userEnv: userEnv, forceNewWindow: true, forceEmpty: true });
} else if (args.pathArguments.length === 0) {
usedWindows = [this.windowsManager.focusLastActive(args)];
usedWindows = [this.windowsService.focusLastActive(args)];
} else {
usedWindows = this.windowsManager.open({
usedWindows = this.windowsService.open({
cli: args,
userEnv: userEnv,
forceNewWindow: args.waitForWindowClose || args.openNewWindow,
......@@ -76,7 +76,7 @@ export class LaunchService implements ILaunchService {
return new TPromise<void>((c, e) => {
const unbind = this.windowsManager.onClose(id => {
const unbind = this.windowsService.onClose(id => {
if (id === windowId) {
unbind();
c(null);
......
......@@ -12,15 +12,14 @@ export const ILogService = createDecorator<ILogService>('logService');
export interface ILogService {
serviceId: ServiceIdentifier<any>;
log(... args: any[]): void;
log(...args: any[]): void;
}
export class MainLogService implements ILogService {
serviceId = ILogService;
constructor(@IEnvironmentService private envService: IEnvironmentService) {
constructor( @IEnvironmentService private envService: IEnvironmentService) {
}
log(...args: any[]): void {
......
......@@ -56,10 +56,10 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
const instantiationService = accessor.get(IInstantiationService);
const logService = accessor.get(ILogService);
const envService = accessor.get(IEnvironmentService);
const windowManager = accessor.get(IWindowsService);
const windowsService = accessor.get(IWindowsService);
const lifecycleService = accessor.get(ILifecycleService);
const updateManager = accessor.get(IUpdateService);
const settingsManager = accessor.get(ISettingsService);
const updateService = accessor.get(IUpdateService);
const settingsService = accessor.get(ISettingsService);
// We handle uncaught exceptions here to prevent electron from opening a dialog to the user
process.on('uncaughtException', (err: any) => {
......@@ -72,7 +72,7 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
};
// handle on client side
windowManager.sendToFocused('vscode:reportError', JSON.stringify(friendlyError));
windowsService.sendToFocused('vscode:reportError', JSON.stringify(friendlyError));
}
console.error('[uncaught exception in main]: ' + err);
......@@ -153,14 +153,14 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
lifecycleService.ready();
// Load settings
settingsManager.loadSync();
settingsService.loadSync();
// Propagate to clients
windowManager.ready(userEnv);
windowsService.ready(userEnv);
// Install Menu
const menuManager = instantiationService.createInstance(VSCodeMenu);
menuManager.ready();
const menu = instantiationService.createInstance(VSCodeMenu);
menu.ready();
// Install Tasks
if (platform.isWindows && envService.isBuilt) {
......@@ -176,15 +176,15 @@ function main(accessor: ServicesAccessor, ipcServer: Server, userEnv: IProcessEn
}
// Setup auto update
updateManager.initialize();
updateService.initialize();
// Open our first window
if (envService.cliArgs.openNewWindow && envService.cliArgs.pathArguments.length === 0) {
windowManager.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths
windowsService.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths
} else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.pathArguments || !envService.cliArgs.pathArguments.length)) {
windowManager.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup
windowsService.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup
} else {
windowManager.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs.openNewWindow, diffMode: envService.cliArgs.diffMode }); // default: read paths from cli
windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs.openNewWindow, diffMode: envService.cliArgs.diffMode }); // default: read paths from cli
}
}
......
......@@ -37,8 +37,8 @@ export class VSCodeMenu {
constructor(
@IStorageService private storageService: IStorageService,
@IUpdateService private updateManager: IUpdateService,
@IWindowsService private windowsManager: IWindowsService,
@IUpdateService private updateService: IUpdateService,
@IWindowsService private windowsService: IWindowsService,
@env.IEnvironmentService private envService: env.IEnvironmentService
) {
this.actionIdKeybindingRequests = [];
......@@ -59,12 +59,12 @@ export class VSCodeMenu {
this.isQuitting = true;
});
// Listen to "open" & "close" event from window manager
this.windowsManager.onOpen((paths) => this.onOpen(paths));
this.windowsManager.onClose(_ => this.onClose(this.windowsManager.getWindowCount()));
// Listen to "open" & "close" event from window service
this.windowsService.onOpen((paths) => this.onOpen(paths));
this.windowsService.onClose(_ => this.onClose(this.windowsService.getWindowCount()));
// Resolve keybindings when any first workbench is loaded
this.windowsManager.onReady((win) => this.resolveKeybindings(win));
this.windowsService.onReady((win) => this.resolveKeybindings(win));
// Listen to resolved keybindings
ipc.on('vscode:keybindingsResolved', (event, rawKeybindings) => {
......@@ -100,8 +100,8 @@ export class VSCodeMenu {
}
});
// Listen to update manager
this.updateManager.on('change', () => this.updateMenu());
// Listen to update service
this.updateService.on('change', () => this.updateMenu());
}
private resolveKeybindings(win: VSCodeWindow): void {
......@@ -213,7 +213,7 @@ export class VSCodeMenu {
this.appMenuInstalled = true;
let dockMenu = new Menu();
dockMenu.append(new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), click: () => this.windowsManager.openNewWindow() }));
dockMenu.append(new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), click: () => this.windowsService.openNewWindow() }));
app.dock.setMenu(dockMenu);
}
......@@ -298,21 +298,21 @@ export class VSCodeMenu {
}
private setFileMenu(fileMenu: Electron.Menu): void {
let hasNoWindows = (this.windowsManager.getWindowCount() === 0);
let hasNoWindows = (this.windowsService.getWindowCount() === 0);
let newFile: Electron.MenuItem;
if (hasNoWindows) {
newFile = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewFile', comment: ['&& denotes a mnemonic'] }, "&&New File")), accelerator: this.getAccelerator('workbench.action.files.newUntitledFile'), click: () => this.windowsManager.openNewWindow() });
newFile = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewFile', comment: ['&& denotes a mnemonic'] }, "&&New File")), accelerator: this.getAccelerator('workbench.action.files.newUntitledFile'), click: () => this.windowsService.openNewWindow() });
} else {
newFile = this.createMenuItem(nls.localize({ key: 'miNewFile', comment: ['&& denotes a mnemonic'] }, "&&New File"), 'workbench.action.files.newUntitledFile');
}
let open = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpen', comment: ['&& denotes a mnemonic'] }, "&&Open...")), accelerator: this.getAccelerator('workbench.action.files.openFileFolder'), click: () => this.windowsManager.openFileFolderPicker() });
let openFolder = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenFolder', comment: ['&& denotes a mnemonic'] }, "Open &&Folder...")), accelerator: this.getAccelerator('workbench.action.files.openFolder'), click: () => this.windowsManager.openFolderPicker() });
let open = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpen', comment: ['&& denotes a mnemonic'] }, "&&Open...")), accelerator: this.getAccelerator('workbench.action.files.openFileFolder'), click: () => this.windowsService.openFileFolderPicker() });
let openFolder = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenFolder', comment: ['&& denotes a mnemonic'] }, "Open &&Folder...")), accelerator: this.getAccelerator('workbench.action.files.openFolder'), click: () => this.windowsService.openFolderPicker() });
let openFile: Electron.MenuItem;
if (hasNoWindows) {
openFile = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenFile', comment: ['&& denotes a mnemonic'] }, "&&Open File...")), accelerator: this.getAccelerator('workbench.action.files.openFile'), click: () => this.windowsManager.openFilePicker() });
openFile = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenFile', comment: ['&& denotes a mnemonic'] }, "&&Open File...")), accelerator: this.getAccelerator('workbench.action.files.openFile'), click: () => this.windowsService.openFilePicker() });
} else {
openFile = this.createMenuItem(nls.localize({ key: 'miOpenFile', comment: ['&& denotes a mnemonic'] }, "&&Open File..."), 'workbench.action.files.openFile');
}
......@@ -321,15 +321,15 @@ export class VSCodeMenu {
this.setOpenRecentMenu(openRecentMenu);
let openRecent = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenRecent', comment: ['&& denotes a mnemonic'] }, "Open &&Recent")), submenu: openRecentMenu, enabled: openRecentMenu.items.length > 0 });
let saveFile = this.createMenuItem(nls.localize({ key: 'miSave', comment: ['&& denotes a mnemonic'] }, "&&Save"), 'workbench.action.files.save', this.windowsManager.getWindowCount() > 0);
let saveFileAs = this.createMenuItem(nls.localize({ key: 'miSaveAs', comment: ['&& denotes a mnemonic'] }, "Save &&As..."), 'workbench.action.files.saveAs', this.windowsManager.getWindowCount() > 0);
let saveAllFiles = this.createMenuItem(nls.localize({ key: 'miSaveAll', comment: ['&& denotes a mnemonic'] }, "Save A&&ll"), 'workbench.action.files.saveAll', this.windowsManager.getWindowCount() > 0);
let saveFile = this.createMenuItem(nls.localize({ key: 'miSave', comment: ['&& denotes a mnemonic'] }, "&&Save"), 'workbench.action.files.save', this.windowsService.getWindowCount() > 0);
let saveFileAs = this.createMenuItem(nls.localize({ key: 'miSaveAs', comment: ['&& denotes a mnemonic'] }, "Save &&As..."), 'workbench.action.files.saveAs', this.windowsService.getWindowCount() > 0);
let saveAllFiles = this.createMenuItem(nls.localize({ key: 'miSaveAll', comment: ['&& denotes a mnemonic'] }, "Save A&&ll"), 'workbench.action.files.saveAll', this.windowsService.getWindowCount() > 0);
let preferences = this.getPreferencesMenu();
let newWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), accelerator: this.getAccelerator('workbench.action.newWindow'), click: () => this.windowsManager.openNewWindow() });
let revertFile = this.createMenuItem(nls.localize({ key: 'miRevert', comment: ['&& denotes a mnemonic'] }, "Revert F&&ile"), 'workbench.action.files.revert', this.windowsManager.getWindowCount() > 0);
let closeWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miCloseWindow', comment: ['&& denotes a mnemonic'] }, "Close &&Window")), accelerator: this.getAccelerator('workbench.action.closeWindow'), click: () => this.windowsManager.getLastActiveWindow().win.close(), enabled: this.windowsManager.getWindowCount() > 0 });
let newWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), accelerator: this.getAccelerator('workbench.action.newWindow'), click: () => this.windowsService.openNewWindow() });
let revertFile = this.createMenuItem(nls.localize({ key: 'miRevert', comment: ['&& denotes a mnemonic'] }, "Revert F&&ile"), 'workbench.action.files.revert', this.windowsService.getWindowCount() > 0);
let closeWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miCloseWindow', comment: ['&& denotes a mnemonic'] }, "Close &&Window")), accelerator: this.getAccelerator('workbench.action.closeWindow'), click: () => this.windowsService.getLastActiveWindow().win.close(), enabled: this.windowsService.getWindowCount() > 0 });
let closeFolder = this.createMenuItem(nls.localize({ key: 'miCloseFolder', comment: ['&& denotes a mnemonic'] }, "Close &&Folder"), 'workbench.action.closeFolder');
let closeEditor = this.createMenuItem(nls.localize({ key: 'miCloseEditor', comment: ['&& denotes a mnemonic'] }, "Close &&Editor"), 'workbench.action.closeActiveEditor');
......@@ -384,8 +384,8 @@ export class VSCodeMenu {
// If the user selected to exit from an extension development host window, do not quit, but just
// close the window unless this is the last window that is opened.
let vscodeWindow = this.windowsManager.getFocusedWindow();
if (vscodeWindow && vscodeWindow.isPluginDevelopmentHost && this.windowsManager.getWindowCount() > 1) {
let vscodeWindow = this.windowsService.getFocusedWindow();
if (vscodeWindow && vscodeWindow.isPluginDevelopmentHost && this.windowsService.getWindowCount() > 1) {
vscodeWindow.win.close();
}
......@@ -435,7 +435,7 @@ export class VSCodeMenu {
private createOpenRecentMenuItem(path: string): Electron.MenuItem {
return new MenuItem({
label: path, click: () => {
let success = !!this.windowsManager.open({ cli: this.envService.cliArgs, pathsToOpen: [path] });
let success = !!this.windowsService.open({ cli: this.envService.cliArgs, pathsToOpen: [path] });
if (!success) {
this.removeFromOpenedPathsList(path);
this.updateMenu();
......@@ -531,7 +531,7 @@ export class VSCodeMenu {
let commands = this.createMenuItem(nls.localize({ key: 'miCommandPalette', comment: ['&& denotes a mnemonic'] }, "&&Command Palette..."), 'workbench.action.showCommands');
let markers = this.createMenuItem(nls.localize({ key: 'miMarker', comment: ['&& denotes a mnemonic'] }, "&&Errors and Warnings..."), 'workbench.action.showErrorsWarnings');
let fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsManager.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsManager.getWindowCount() > 0 });
let fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsService.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsService.getWindowCount() > 0 });
let toggleMenuBar = this.createMenuItem(nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar"), 'workbench.action.toggleMenuBar');
let splitEditor = this.createMenuItem(nls.localize({ key: 'miSplitEditor', comment: ['&& denotes a mnemonic'] }, "Split &&Editor"), 'workbench.action.splitEditor');
let toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility');
......@@ -629,9 +629,9 @@ export class VSCodeMenu {
}
private setMacWindowMenu(macWindowMenu: Electron.Menu): void {
let minimize = new MenuItem({ label: nls.localize('mMinimize', "Minimize"), role: 'minimize', accelerator: 'Command+M', enabled: this.windowsManager.getWindowCount() > 0 });
let close = new MenuItem({ label: nls.localize('mClose', "Close"), role: 'close', accelerator: 'Command+W', enabled: this.windowsManager.getWindowCount() > 0 });
let bringAllToFront = new MenuItem({ label: nls.localize('mBringToFront', "Bring All to Front"), role: 'front', enabled: this.windowsManager.getWindowCount() > 0 });
let minimize = new MenuItem({ label: nls.localize('mMinimize', "Minimize"), role: 'minimize', accelerator: 'Command+M', enabled: this.windowsService.getWindowCount() > 0 });
let close = new MenuItem({ label: nls.localize('mClose', "Close"), role: 'close', accelerator: 'Command+W', enabled: this.windowsService.getWindowCount() > 0 });
let bringAllToFront = new MenuItem({ label: nls.localize('mBringToFront', "Bring All to Front"), role: 'front', enabled: this.windowsService.getWindowCount() > 0 });
[
minimize,
......@@ -642,7 +642,7 @@ export class VSCodeMenu {
}
private toggleDevTools(): void {
let w = this.windowsManager.getFocusedWindow();
let w = this.windowsService.getFocusedWindow();
if (w && w.win) {
w.win.webContents.toggleDevTools();
}
......@@ -653,7 +653,7 @@ export class VSCodeMenu {
label: mnemonicLabel(nls.localize({ key: 'miToggleDevTools', comment: ['&& denotes a mnemonic'] }, "&&Toggle Developer Tools")),
accelerator: this.getAccelerator('workbench.action.toggleDevTools'),
click: () => this.toggleDevTools(),
enabled: (this.windowsManager.getWindowCount() > 0)
enabled: (this.windowsService.getWindowCount() > 0)
});
arrays.coalesce([
......@@ -701,12 +701,12 @@ export class VSCodeMenu {
}
private getUpdateMenuItems(): Electron.MenuItem[] {
switch (this.updateManager.state) {
switch (this.updateService.state) {
case UpdateState.Uninitialized:
return [];
case UpdateState.UpdateDownloaded:
let update = this.updateManager.availableUpdate;
let update = this.updateService.availableUpdate;
return [new MenuItem({
label: nls.localize('miRestartToUpdate', "Restart To Update..."), click: () => {
this.reportMenuActionTelemetry('RestartToUpdate');
......@@ -719,7 +719,7 @@ export class VSCodeMenu {
case UpdateState.UpdateAvailable:
if (platform.isLinux) {
const update = this.updateManager.availableUpdate;
const update = this.updateService.availableUpdate;
return [new MenuItem({
label: nls.localize('miDownloadUpdate', "Download Available Update"), click: () => {
update.quitAndUpdate();
......@@ -737,12 +737,12 @@ export class VSCodeMenu {
let result = [new MenuItem({
label: nls.localize('miCheckForUpdates', "Check For Updates..."), click: () => setTimeout(() => {
this.reportMenuActionTelemetry('CheckForUpdate');
this.updateManager.checkForUpdates(true);
this.updateService.checkForUpdates(true);
}, 0)
})];
if (this.updateManager.lastCheckDate) {
result.push(new MenuItem({ label: nls.localize('miLastCheckedAt', "Last checked at {0}", this.updateManager.lastCheckDate.toLocaleTimeString()), enabled: false }));
if (this.updateService.lastCheckDate) {
result.push(new MenuItem({ label: nls.localize('miLastCheckedAt', "Last checked at {0}", this.updateService.lastCheckDate.toLocaleTimeString()), enabled: false }));
}
return result;
......@@ -753,8 +753,8 @@ export class VSCodeMenu {
private createMenuItem(label: string, click: () => void, enabled?: boolean): Electron.MenuItem;
private createMenuItem(arg1: string, arg2: any, arg3?: boolean): Electron.MenuItem {
let label = mnemonicLabel(arg1);
let click: () => void = (typeof arg2 === 'function') ? arg2 : () => this.windowsManager.sendToFocused('vscode:runAction', arg2);
let enabled = typeof arg3 === 'boolean' ? arg3 : this.windowsManager.getWindowCount() > 0;
let click: () => void = (typeof arg2 === 'function') ? arg2 : () => this.windowsService.sendToFocused('vscode:runAction', arg2);
let enabled = typeof arg3 === 'boolean' ? arg3 : this.windowsService.getWindowCount() > 0;
let actionId: string;
if (typeof arg2 === 'string') {
......@@ -775,9 +775,9 @@ export class VSCodeMenu {
return new MenuItem({
label: mnemonicLabel(label),
accelerator: this.getAccelerator(actionId),
enabled: this.windowsManager.getWindowCount() > 0,
enabled: this.windowsService.getWindowCount() > 0,
click: () => {
let windowInFocus = this.windowsManager.getFocusedWindow();
let windowInFocus = this.windowsService.getFocusedWindow();
if (!windowInFocus) {
return;
}
......@@ -785,7 +785,7 @@ export class VSCodeMenu {
if (windowInFocus.win.isDevToolsFocused()) {
devToolsFocusedFn(windowInFocus.win.devToolsWebContents);
} else {
this.windowsManager.sendToFocused('vscode:runAction', actionId);
this.windowsService.sendToFocused('vscode:runAction', actionId);
}
}
});
......@@ -811,7 +811,7 @@ export class VSCodeMenu {
}
private openAboutDialog(): void {
let lastActiveWindow = this.windowsManager.getFocusedWindow() || this.windowsManager.getLastActiveWindow();
let lastActiveWindow = this.windowsService.getFocusedWindow() || this.windowsService.getLastActiveWindow();
dialog.showMessageBox(lastActiveWindow && lastActiveWindow.win, {
title: this.envService.product.nameLong,
......@@ -839,7 +839,7 @@ export class VSCodeMenu {
}
private reportMenuActionTelemetry(id: string): void {
this.windowsManager.sendToFocused('vscode:telemetry', { eventName: 'workbenchActionExecuted', data: { id, from: 'menu' } });
this.windowsService.sendToFocused('vscode:telemetry', { eventName: 'workbenchActionExecuted', data: { id, from: 'menu' } });
}
}
......
......@@ -72,7 +72,7 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
@IInstantiationService instantiationService: IInstantiationService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IEnvironmentService private envService: IEnvironmentService,
@ISettingsService private settingsManager: ISettingsService
@ISettingsService private settingsService: ISettingsService
) {
super();
......@@ -230,7 +230,7 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
}
private getUpdateChannel(): string {
const channel = this.settingsManager.getValue('update.channel') || 'default';
const channel = this.settingsService.getValue('update.channel') || 'default';
return channel === 'none' ? null : this.envService.quality;
}
......@@ -247,6 +247,6 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
return null;
}
return `${ this.envService.updateUrl }/api/update/${ getPlatformIdentifier() }/${ channel }/${ this.envService.product.commit }`;
return `${this.envService.updateUrl}/api/update/${getPlatformIdentifier()}/${channel}/${this.envService.product.commit}`;
}
}
......@@ -126,8 +126,8 @@ export class WindowsManager implements IWindowsService {
@IStorageService private storageService: IStorageService,
@IEnvironmentService private envService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IUpdateService private updateManager: IUpdateService,
@ISettingsService private settingsManager: ISettingsService
@IUpdateService private updateService: IUpdateService,
@ISettingsService private settingsService: ISettingsService
) { }
onOpen(clb: (path: IPath) => void): () => void {
......@@ -194,7 +194,7 @@ export class WindowsManager implements IWindowsService {
}, 100);
});
this.settingsManager.onChange((newSettings) => {
this.settingsService.onChange((newSettings) => {
this.sendToAll('vscode:optionsChange', JSON.stringify({ globalSettings: newSettings }));
}, this);
......@@ -412,7 +412,7 @@ export class WindowsManager implements IWindowsService {
}
});
this.updateManager.on('update-downloaded', (update: IUpdate) => {
this.updateService.on('update-downloaded', (update: IUpdate) => {
this.sendToFocused('vscode:telemetry', { eventName: 'update:downloaded', data: { version: update.version } });
this.sendToAll('vscode:update-downloaded', JSON.stringify({
......@@ -425,12 +425,12 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:update-apply', () => {
this.logService.log('IPC#vscode:update-apply');
if (this.updateManager.availableUpdate) {
this.updateManager.availableUpdate.quitAndUpdate();
if (this.updateService.availableUpdate) {
this.updateService.availableUpdate.quitAndUpdate();
}
});
this.updateManager.on('update-not-available', (explicit: boolean) => {
this.updateService.on('update-not-available', (explicit: boolean) => {
this.sendToFocused('vscode:telemetry', { eventName: 'update:notAvailable', data: { explicit } });
if (explicit) {
......@@ -438,7 +438,7 @@ export class WindowsManager implements IWindowsService {
}
});
this.updateManager.on('update-available', (url: string) => {
this.updateService.on('update-available', (url: string) => {
if (url) {
this.sendToFocused('vscode:update-available', url);
}
......@@ -579,7 +579,7 @@ export class WindowsManager implements IWindowsService {
} else {
openFilesInNewWindow = openConfig.preferNewWindow;
if (openFilesInNewWindow && !openConfig.cli.extensionDevelopmentPath) { // can be overriden via settings (not for PDE though!)
openFilesInNewWindow = this.settingsManager.getValue('window.openFilesInNewWindow', openFilesInNewWindow);
openFilesInNewWindow = this.settingsService.getValue('window.openFilesInNewWindow', openFilesInNewWindow);
}
}
......@@ -749,8 +749,8 @@ export class WindowsManager implements IWindowsService {
configuration.productDownloadUrl = this.envService.product.downloadUrl;
configuration.releaseNotesUrl = this.envService.product.releaseNotesUrl;
configuration.licenseUrl = this.envService.product.licenseUrl;
configuration.updateFeedUrl = this.updateManager.feedUrl;
configuration.updateChannel = this.updateManager.channel;
configuration.updateFeedUrl = this.updateService.feedUrl;
configuration.updateChannel = this.updateService.channel;
configuration.aiConfig = this.envService.product.aiConfig;
configuration.sendASmile = this.envService.product.sendASmile;
configuration.enableTelemetry = this.envService.product.enableTelemetry;
......@@ -841,7 +841,7 @@ export class WindowsManager implements IWindowsService {
// No path argument, check settings for what to do now
else {
let reopenFolders = this.settingsManager.getValue('window.reopenFolders', 'one');
let reopenFolders = this.settingsService.getValue('window.reopenFolders', 'one');
let lastActiveFolder = this.windowsState.lastActiveWindow && this.windowsState.lastActiveWindow.workspacePath;
// Restore all
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册