提交 16635b80 编写于 作者: B Benjamin Pasero

debt - move out more things from workbench

上级 3a934189
......@@ -52,8 +52,6 @@ export class LifecycleService extends Disposable implements ILifecycleService {
this._startupKind = this.resolveStartupKind();
this.registerListeners();
this._phase = LifecyclePhase.Ready;
}
private resolveStartupKind(): StartupKind {
......
......@@ -20,7 +20,8 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { stat } from 'vs/base/node/pfs';
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
import { IWindowConfiguration, IWindowsService } from 'vs/platform/windows/common/windows';
import { IWindowConfiguration, IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
import { WindowService } from 'vs/platform/windows/electron-browser/windowService';
import { WindowsChannelClient } from 'vs/platform/windows/node/windowsIpc';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { Client as ElectronIPCClient } from 'vs/base/parts/ipc/electron-browser/ipc.electron-browser';
......@@ -170,6 +171,9 @@ class CodeRendererMain extends Disposable {
const windowsChannel = electronMainClient.getChannel('windows');
serviceCollection.set(IWindowsService, new WindowsChannelClient(windowsChannel));
// Window
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, [this.configuration]));
// Update Service
const updateChannel = electronMainClient.getChannel('update');
serviceCollection.set(IUpdateService, new SyncDescriptor(UpdateChannelClient, [updateChannel]));
......
......@@ -35,7 +35,6 @@ import { IFileService } from 'vs/platform/files/common/files';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { LifecyclePhase, StartupKind, ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows';
......@@ -63,16 +62,6 @@ import { Part } from 'vs/workbench/browser/part';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
// import@node
import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
import { IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { DownloadServiceChannel } from 'vs/platform/download/node/downloadIpc';
import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
// import@electron-browser
import { WindowService } from 'vs/platform/windows/electron-browser/windowService';
enum Settings {
MENUBAR_VISIBLE = 'window.menuBarVisibility',
ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible',
......@@ -269,37 +258,23 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
private initServices(serviceCollection: ServiceCollection): void {
// Parts
serviceCollection.set(IWorkbenchLayoutService, this); // TODO@Ben use SyncDescriptor
// Window
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, [this.configuration]));
// Layout Service
serviceCollection.set(IWorkbenchLayoutService, this);
// Contributed services
// All Contributed Services
const contributedServices = getServices();
for (let contributedService of contributedServices) {
serviceCollection.set(contributedService.id, contributedService.descriptor);
}
// TODO@Steven this should move somewhere else
// Wrap up
this.instantiationService.invokeFunction(accessor => {
const sharedProcessService = accessor.get(ISharedProcessService);
sharedProcessService.registerChannel('dialog', this.instantiationService.createInstance(DialogChannel));
});
// Signal to lifecycle that services are set
const lifecycleService = accessor.get(ILifecycleService);
lifecycleService.phase = LifecyclePhase.Ready;
// TODO@Alex TODO@Sandeep this should move somewhere else
this.instantiationService.invokeFunction(accessor => {
const remoteAgentConnection = accessor.get(IRemoteAgentService).getConnection();
if (remoteAgentConnection) {
remoteAgentConnection.registerChannel('dialog', this.instantiationService.createInstance(DialogChannel));
remoteAgentConnection.registerChannel('download', new DownloadServiceChannel());
remoteAgentConnection.registerChannel('loglevel', new LogLevelSetterChannel(this.logService));
}
});
// TODO@Sandeep TODO@Martin debt around cyclic dependencies
this.instantiationService.invokeFunction(accessor => {
// TODO@Sandeep TODO@Martin debt around cyclic dependencies
const fileService = accessor.get(IFileService);
const instantiationService = accessor.get(IInstantiationService);
const configurationService = accessor.get(IConfigurationService) as any;
......
......@@ -23,6 +23,8 @@ import { WORKSPACE_EXTENSION } from 'vs/platform/workspaces/common/workspaces';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ISharedProcessService } from 'vs/platform/sharedProcess/node/sharedProcessService';
import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
interface IMassagedMessageBoxOptions {
......@@ -45,8 +47,11 @@ export class DialogService implements IDialogService {
constructor(
@IWindowService private readonly windowService: IWindowService,
@ILogService private readonly logService: ILogService
) { }
@ILogService private readonly logService: ILogService,
@ISharedProcessService sharedProcessService: ISharedProcessService
) {
sharedProcessService.registerChannel('dialog', new DialogChannel(this));
}
confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
this.logService.trace('DialogService#confirm', confirmation.message);
......
......@@ -15,6 +15,12 @@ import { RemoteExtensionEnvironmentChannelClient } from 'vs/workbench/services/r
import { IRemoteAgentConnection, IRemoteAgentEnvironment, IRemoteAgentService } from 'vs/workbench/services/remote/node/remoteAgentService';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
import { DownloadServiceChannel } from 'vs/platform/download/node/downloadIpc';
import { LogLevelSetterChannel } from 'vs/platform/log/node/logIpc';
import { ILogService } from 'vs/platform/log/common/log';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class RemoteAgentService implements IRemoteAgentService {
......@@ -26,11 +32,20 @@ export class RemoteAgentService implements IRemoteAgentService {
@IWindowService windowService: IWindowService,
@INotificationService notificationService: INotificationService,
@IEnvironmentService environmentService: IEnvironmentService,
@IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService
@IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@ILifecycleService lifecycleService: ILifecycleService,
@ILogService logService: ILogService,
@IInstantiationService instantiationService: IInstantiationService
) {
const { remoteAuthority } = windowService.getConfiguration();
if (remoteAuthority) {
this._connection = new RemoteAgentConnection(remoteAuthority, notificationService, environmentService, remoteAuthorityResolverService);
const connection = this._connection = new RemoteAgentConnection(remoteAuthority, notificationService, environmentService, remoteAuthorityResolverService);
lifecycleService.when(LifecyclePhase.Ready).then(() => {
connection.registerChannel('dialog', instantiationService.createInstance(DialogChannel));
connection.registerChannel('download', new DownloadServiceChannel());
connection.registerChannel('loglevel', new LogLevelSetterChannel(logService));
});
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册