mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-18 01:20:52 +01:00
debt - shuffle some windows service methods around
This commit is contained in:
@@ -1181,9 +1181,9 @@ export class WindowsManager implements IWindowsMainService {
|
||||
this.fileDialog.pickAndOpen({ pickFolders: true, forceNewWindow, window, title: nls.localize('openFolder', "Open Folder") }, 'openFolder', data);
|
||||
}
|
||||
|
||||
public pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
public pickFolder(window?: CodeWindow, options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
return new TPromise((c, e) => {
|
||||
this.fileDialog.getFileOrFolderPaths({ pickFolders: true, buttonLabel: options && options.buttonLabel }, folders => {
|
||||
this.fileDialog.getFileOrFolderPaths({ pickFolders: true, window, buttonLabel: options && options.buttonLabel }, folders => {
|
||||
c(folders || []);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface IWindowsService {
|
||||
pickFileFolderAndOpen(windowId: number, forceNewWindow?: boolean, data?: ITelemetryData): TPromise<void>;
|
||||
pickFileAndOpen(windowId: number, forceNewWindow?: boolean, path?: string, data?: ITelemetryData): TPromise<void>;
|
||||
pickFolderAndOpen(windowId: number, forceNewWindow?: boolean, data?: ITelemetryData): TPromise<void>;
|
||||
pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]>;
|
||||
pickFolder(windowId: number, options?: { buttonLabel: string; title: string; }): TPromise<string[]>;
|
||||
reloadWindow(windowId: number): TPromise<void>;
|
||||
openDevTools(windowId: number): TPromise<void>;
|
||||
toggleDevTools(windowId: number): TPromise<void>;
|
||||
@@ -86,8 +86,6 @@ export interface IWindowService {
|
||||
closeFolder(): TPromise<void>;
|
||||
toggleFullScreen(): TPromise<void>;
|
||||
setRepresentedFilename(fileName: string): TPromise<void>;
|
||||
addToRecentlyOpen(paths: { path: string, isFile?: boolean }[]): TPromise<void>;
|
||||
removeFromRecentlyOpen(paths: string[]): TPromise<void>;
|
||||
getRecentlyOpen(): TPromise<{ files: string[]; folders: string[]; }>;
|
||||
focusWindow(): TPromise<void>;
|
||||
closeWindow(): TPromise<void>;
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface IWindowsChannel extends IChannel {
|
||||
call(command: 'pickFileFolderAndOpen', arg: [number, boolean, ITelemetryData]): TPromise<void>;
|
||||
call(command: 'pickFileAndOpen', arg: [number, boolean, string, ITelemetryData]): TPromise<void>;
|
||||
call(command: 'pickFolderAndOpen', arg: [number, boolean, ITelemetryData]): TPromise<void>;
|
||||
call(command: 'pickFolder', arg: { buttonLabel: string; title: string; }): TPromise<string[]>;
|
||||
call(command: 'pickFolder', arg: [number, { buttonLabel: string; title: string; }]): TPromise<string[]>;
|
||||
call(command: 'reloadWindow', arg: number): TPromise<void>;
|
||||
call(command: 'toggleDevTools', arg: number): TPromise<void>;
|
||||
call(command: 'closeFolder', arg: number): TPromise<void>;
|
||||
@@ -69,7 +69,7 @@ export class WindowsChannel implements IWindowsChannel {
|
||||
case 'pickFileFolderAndOpen': return this.service.pickFileFolderAndOpen(arg[0], arg[1], arg[2]);
|
||||
case 'pickFileAndOpen': return this.service.pickFileAndOpen(arg[0], arg[1], arg[2], arg[3]);
|
||||
case 'pickFolderAndOpen': return this.service.pickFolderAndOpen(arg[0], arg[1], arg[2]);
|
||||
case 'pickFolder': return this.service.pickFolder(arg);
|
||||
case 'pickFolder': return this.service.pickFolder(arg[0], arg[1]);
|
||||
case 'reloadWindow': return this.service.reloadWindow(arg);
|
||||
case 'openDevTools': return this.service.openDevTools(arg);
|
||||
case 'toggleDevTools': return this.service.toggleDevTools(arg);
|
||||
@@ -131,8 +131,8 @@ export class WindowsChannelClient implements IWindowsService {
|
||||
return this.channel.call('pickFolderAndOpen', [windowId, forceNewWindow, data]);
|
||||
}
|
||||
|
||||
pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
return this.channel.call('pickFolder', options);
|
||||
pickFolder(windowId: number, options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
return this.channel.call('pickFolder', [windowId, options]);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number): TPromise<void> {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class WindowService implements IWindowService {
|
||||
}
|
||||
|
||||
pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
return this.windowsService.pickFolder(options);
|
||||
return this.windowsService.pickFolder(this.windowId, options);
|
||||
}
|
||||
|
||||
reloadWindow(): TPromise<void> {
|
||||
@@ -66,14 +66,6 @@ export class WindowService implements IWindowService {
|
||||
return this.windowsService.setRepresentedFilename(this.windowId, fileName);
|
||||
}
|
||||
|
||||
addToRecentlyOpen(paths: { path: string, isFile?: boolean }[]): TPromise<void> {
|
||||
return this.windowsService.addToRecentlyOpen(paths);
|
||||
}
|
||||
|
||||
removeFromRecentlyOpen(paths: string[]): TPromise<void> {
|
||||
return this.windowsService.removeFromRecentlyOpen(paths);
|
||||
}
|
||||
|
||||
getRecentlyOpen(): TPromise<{ files: string[]; folders: string[]; }> {
|
||||
return this.windowsService.getRecentlyOpen(this.windowId);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export interface IWindowsMainService {
|
||||
pickFileFolderAndOpen(forceNewWindow?: boolean, data?: ITelemetryData): void;
|
||||
pickFileAndOpen(forceNewWindow?: boolean, path?: string, window?: ICodeWindow, data?: ITelemetryData): void;
|
||||
pickFolderAndOpen(forceNewWindow?: boolean, window?: ICodeWindow, data?: ITelemetryData): void;
|
||||
pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]>;
|
||||
pickFolder(window?: ICodeWindow, options?: { buttonLabel: string; title: string; }): TPromise<string[]>;
|
||||
focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow;
|
||||
getLastActiveWindow(): ICodeWindow;
|
||||
waitForWindowClose(windowId: number): TPromise<void>;
|
||||
|
||||
@@ -67,8 +67,10 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
return this.windowsMainService.pickFolder(options);
|
||||
pickFolder(windowId: number, options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
return this.windowsMainService.pickFolder(codeWindow, options);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number): TPromise<void> {
|
||||
|
||||
@@ -73,6 +73,10 @@ export class AddRootFolderAction extends Action {
|
||||
}
|
||||
|
||||
return this.windowService.pickFolder({ buttonLabel: nls.localize('add', "Add"), title: nls.localize('addFolderToWorkspaceTitle', "Add Folder to Workspace") }).then(folders => {
|
||||
if (!folders.length) {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
return this.workspaceEditingService.addRoots(folders.map(folder => URI.file(folder))).then(() => {
|
||||
return this.viewletService.openViewlet(this.viewletService.getDefaultViewletId(), true);
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ import { TitleControl, ITitleAreaControl } from 'vs/workbench/browser/parts/edit
|
||||
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
|
||||
import { IEditorStacksModel, IStacksModelChangeEvent, IEditorGroup, EditorOptions, TextEditorOptions, IEditorIdentifier } from 'vs/workbench/common/editor';
|
||||
import { extractResources } from 'vs/base/browser/dnd';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { editorBackground, contrastBorder, activeContrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
@@ -147,6 +147,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
@IExtensionService private extensionService: IExtensionService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@IWindowsService private windowsService: IWindowsService,
|
||||
@IThemeService themeService: IThemeService
|
||||
) {
|
||||
super(themeService);
|
||||
@@ -1117,7 +1118,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
|
||||
// Add external ones to recently open list
|
||||
const externalResources = droppedResources.filter(d => d.isExternal).map(d => d.resource);
|
||||
if (externalResources.length) {
|
||||
$this.windowService.addToRecentlyOpen(externalResources.map(resource => {
|
||||
$this.windowsService.addToRecentlyOpen(externalResources.map(resource => {
|
||||
return {
|
||||
path: resource.fsPath,
|
||||
isFile: true
|
||||
|
||||
@@ -29,7 +29,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IDisposable, dispose, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -72,6 +72,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
@IMenuService menuService: IMenuService,
|
||||
@IQuickOpenService quickOpenService: IQuickOpenService,
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@IWindowsService private windowsService: IWindowsService,
|
||||
@IThemeService themeService: IThemeService
|
||||
) {
|
||||
super(contextMenuService, instantiationService, editorService, editorGroupService, contextKeyService, keybindingService, telemetryService, messageService, menuService, quickOpenService, themeService);
|
||||
@@ -690,7 +691,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
// Add external ones to recently open list
|
||||
const externalResources = resources.filter(d => d.isExternal).map(d => d.resource);
|
||||
if (externalResources.length) {
|
||||
this.windowService.addToRecentlyOpen(externalResources.map(resource => {
|
||||
this.windowsService.addToRecentlyOpen(externalResources.map(resource => {
|
||||
return {
|
||||
path: resource.fsPath,
|
||||
isFile: true
|
||||
|
||||
@@ -23,7 +23,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { once } from 'vs/base/common/event';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getExcludes, ISearchConfiguration } from 'vs/platform/search/common/search';
|
||||
import { parse, IExpression } from 'vs/base/common/glob';
|
||||
@@ -166,7 +166,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
@ILifecycleService private lifecycleService: ILifecycleService,
|
||||
@IFileService private fileService: IFileService,
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@IWindowsService private windowService: IWindowsService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
) {
|
||||
super(editorGroupService, editorService);
|
||||
|
||||
@@ -881,14 +881,6 @@ export class TestWindowService implements IWindowService {
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
addToRecentlyOpen(paths: { path: string, isFile?: boolean }[]): TPromise<void> {
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
removeFromRecentlyOpen(paths: string[]): TPromise<void> {
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
getRecentlyOpen(): TPromise<{ files: string[]; folders: string[]; }> {
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
@@ -980,7 +972,7 @@ export class TestWindowsService implements IWindowsService {
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
pickFolder(windowId: number, options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
|
||||
return TPromise.as([]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user