提交 fd1d5e5a 编写于 作者: H heycalmdown

Change a behavior as Switch 'Workspace -> Window'

上级 d797ec32
......@@ -432,11 +432,11 @@ export class WindowsManager implements IWindowsService {
}
});
ipc.on('vscode:switchWorkspace', (event, windowId: number) => {
ipc.on('vscode:switchWindow', (event, windowId: number) => {
const windows = this.getWindows();
const window = this.getWindowById(windowId);
window.send('vscode:switchWorkspace', windows.filter(w => !!w.openedWorkspacePath).map(w => {
return {path: w.openedWorkspacePath, id: w.id};
window.send('vscode:switchWindow', windows.map(w => {
return {path: w.openedWorkspacePath, title: w.win.getTitle(), id: w.id};
}));
});
......
......@@ -71,10 +71,10 @@ export class CloseWindowAction extends Action {
}
}
export class SwitchWorkspace extends Action {
export class SwitchWindow extends Action {
public static ID = 'workbench.action.switchWorkspace';
public static LABEL = nls.localize('switchWorkspace', "Switch Workspace");
public static ID = 'workbench.action.switchWindow';
public static LABEL = nls.localize('switchWindow', "Switch Window");
constructor(
id: string,
......@@ -86,18 +86,17 @@ export class SwitchWorkspace extends Action {
}
public run(): TPromise<boolean> {
ipc.send('vscode:switchWorkspace', this.windowService.getWindowId());
ipc.once('vscode:switchWorkspace', (event, workspaces) => {
ipc.send('vscode:switchWindow', this.windowService.getWindowId());
ipc.once('vscode:switchWindow', (event, workspaces) => {
const picks: IPickOpenEntry[] = workspaces.map(w => {
return {
label: paths.basename(w.path),
description: paths.dirname(w.path),
label: w.title,
run: () => {
ipc.send('vscode:showWindow', w.id);
}
};
});
this.quickOpenService.pick(picks, {matchOnDescription: true});
this.quickOpenService.pick(picks, {placeHolder: nls.localize('switchWindowPlaceHolder', "Select a window")});
});
return TPromise.as(true);
......
......@@ -15,7 +15,7 @@ import platform = require('vs/base/common/platform');
import {IKeybindings} from 'vs/platform/keybinding/common/keybinding';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import {CloseEditorAction, ReloadWindowAction, ShowStartupPerformance, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleDevToolsAction, ToggleFullScreenAction, ToggleMenuBarAction, OpenRecentAction, CloseFolderAction, CloseWindowAction, SwitchWorkspace, NewWindowAction, CloseMessagesAction} from 'vs/workbench/electron-browser/actions';
import {CloseEditorAction, ReloadWindowAction, ShowStartupPerformance, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleDevToolsAction, ToggleFullScreenAction, ToggleMenuBarAction, OpenRecentAction, CloseFolderAction, CloseWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction} from 'vs/workbench/electron-browser/actions';
import {MessagesVisibleContext, NoEditorsVisibleContext} from 'vs/workbench/electron-browser/workbench';
const closeEditorOrWindowKeybindings: IKeybindings = { primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] }};
......@@ -27,7 +27,7 @@ const fileCategory = nls.localize('file', "File");
const workbenchActionsRegistry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NewWindowAction, NewWindowAction.ID, NewWindowAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_N }), 'New Window');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseWindowAction, CloseWindowAction.ID, CloseWindowAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_W }), 'Close Window');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SwitchWorkspace, SwitchWorkspace.ID, SwitchWorkspace.LABEL), 'Switch Workspace');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SwitchWindow, SwitchWindow.ID, SwitchWindow.LABEL), 'Switch Window');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseFolderAction, CloseFolderAction.ID, CloseFolderAction.LABEL, { primary: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_F) }), 'File: Close Folder', fileCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenRecentAction, OpenRecentAction.ID, OpenRecentAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_R } }), 'File: Open Recent', fileCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleDevToolsAction, ToggleDevToolsAction.ID, ToggleDevToolsAction.LABEL), 'Developer: Toggle Developer Tools', developerCategory);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册