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

update menu properly after transitioning workspaces

上级 f7e323cb
......@@ -119,6 +119,7 @@ export class CodeMenu {
this.windowsService.onWindowsCountChanged(e => this.onWindowsCountChanged(e));
this.windowsService.onActiveWindowChanged(() => this.updateWorkspaceMenuItems());
this.windowsService.onWindowReady(() => this.updateWorkspaceMenuItems());
this.windowsService.onWindowWorkspaceOpen(() => this.updateWorkspaceMenuItems());
this.windowsService.onWindowClose(() => this.updateWorkspaceMenuItems());
// Listen to extension viewlets
......
......@@ -125,6 +125,9 @@ export class WindowsManager implements IWindowsMainService {
private _onWindowLoad = new Emitter<number>();
onWindowLoad: CommonEvent<number> = this._onWindowLoad.event;
private _onWindowOpenWorkspace = new Emitter<number>();
onWindowWorkspaceOpen: CommonEvent<number> = this._onWindowOpenWorkspace.event;
private _onActiveWindowChanged = new Emitter<CodeWindow>();
onActiveWindowChanged: CommonEvent<CodeWindow> = this._onActiveWindowChanged.event;
......@@ -1295,11 +1298,23 @@ export class WindowsManager implements IWindowsMainService {
}
public saveAndOpenWorkspace(win: CodeWindow, path: string): TPromise<IWorkspaceIdentifier> {
return this.workspacesManager.saveAndOpenWorkspace(win, path);
return this.workspacesManager.saveAndOpenWorkspace(win, path).then(workspace => {
// Event
this._onWindowOpenWorkspace.fire(win.id);
return workspace;
});
}
public createAndOpenWorkspace(win: CodeWindow, folders?: string[], path?: string): TPromise<IWorkspaceIdentifier> {
return this.workspacesManager.createAndOpenWorkspace(win, folders, path);
return this.workspacesManager.createAndOpenWorkspace(win, folders, path).then(workspace => {
// Event
this._onWindowOpenWorkspace.fire(win.id);
return workspace;
});
}
public openWorkspace(win?: CodeWindow): void {
......
......@@ -56,6 +56,7 @@ export interface IWindowsMainService {
onWindowsCountChanged: Event<IWindowsCountChangedEvent>;
onWindowClose: Event<number>;
onWindowReload: Event<number>;
onWindowWorkspaceOpen: Event<number>;
// methods
ready(initialUserEnv: IProcessEnvironment): void;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册