@@ -9,14 +9,14 @@ import { TPromise } from 'vs/base/common/winjs.base';
99import { Action } from 'vs/base/common/actions' ;
1010import nls = require( 'vs/nls' ) ;
1111import { distinct } from 'vs/base/common/arrays' ;
12- import { IWindowService , IWindowsService } from 'vs/platform/windows/common/windows' ;
12+ import { IWindowService } from 'vs/platform/windows/common/windows' ;
1313import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry' ;
1414import { IWorkspaceContextService , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
1515import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing' ;
1616import URI from 'vs/base/common/uri' ;
1717import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet' ;
1818import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
19- import { IWorkspacesService , WORKSPACE_FILTER } from 'vs/platform/workspaces/common/workspaces' ;
19+ import { WORKSPACE_FILTER } from 'vs/platform/workspaces/common/workspaces' ;
2020import { IMessageService , Severity } from 'vs/platform/message/common/message' ;
2121import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
2222import { isLinux } from 'vs/base/common/platform' ;
@@ -113,10 +113,12 @@ export class AddRootFolderAction extends BaseWorkspacesAction {
113113 if ( ! folders || ! folders . length ) {
114114 return TPromise . as ( null ) ;
115115 }
116+
116117 return this . workspaceEditingService . addFolders ( folders . map ( folder => URI . file ( folder ) ) ) . then ( ( ) => {
117118 return this . viewletService . openViewlet ( this . viewletService . getDefaultViewletId ( ) , true ) ;
118119 } ) ;
119120 }
121+
120122 return this . instantiationService . createInstance ( NewWorkspaceAction , NewWorkspaceAction . ID , NewWorkspaceAction . LABEL , this . contextService . getWorkspace ( ) . folders . map ( folder => folder . uri ) ) . run ( ) ;
121123 }
122124}
@@ -133,8 +135,7 @@ class NewWorkspaceAction extends BaseWorkspacesAction {
133135 @IWindowService windowService : IWindowService ,
134136 @IWorkspaceContextService contextService : IWorkspaceContextService ,
135137 @IEnvironmentService environmentService : IEnvironmentService ,
136- @IWorkspacesService protected workspacesService : IWorkspacesService ,
137- @IWindowsService protected windowsService : IWindowsService ,
138+ @IWorkspaceEditingService private workspaceEditingService : IWorkspaceEditingService
138139 ) {
139140 super ( id , label , windowService , environmentService , contextService ) ;
140141 }
@@ -151,7 +152,7 @@ class NewWorkspaceAction extends BaseWorkspacesAction {
151152 private createWorkspace ( folders : URI [ ] ) : TPromise < void > {
152153 const workspaceFolders = distinct ( folders . map ( folder => folder . fsPath ) , folder => isLinux ? folder : folder . toLowerCase ( ) ) ;
153154
154- return this . windowService . createAndOpenWorkspace ( workspaceFolders ) ;
155+ return this . workspaceEditingService . createAndOpenWorkspace ( workspaceFolders ) ;
155156 }
156157}
157158
@@ -185,9 +186,8 @@ export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
185186 @IWindowService windowService : IWindowService ,
186187 @IEnvironmentService environmentService : IEnvironmentService ,
187188 @IWorkspaceContextService contextService : IWorkspaceContextService ,
188- @IWorkspacesService protected workspacesService : IWorkspacesService ,
189- @IWindowsService private windowsService : IWindowsService ,
190- @IMessageService private messageService : IMessageService
189+ @IMessageService private messageService : IMessageService ,
190+ @IWorkspaceEditingService private workspaceEditingService : IWorkspaceEditingService
191191 ) {
192192 super ( id , label , windowService , environmentService , contextService ) ;
193193 }
@@ -196,6 +196,7 @@ export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
196196 const workspaceState = this . contextService . getWorkbenchState ( ) ;
197197 if ( workspaceState === WorkbenchState . EMPTY ) {
198198 this . messageService . show ( Severity . Info , nls . localize ( 'saveEmptyWorkspaceNotSupported' , "Please open a workspace first to save." ) ) ;
199+
199200 return TPromise . as ( null ) ;
200201 }
201202
@@ -205,10 +206,10 @@ export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
205206
206207 case WorkbenchState . FOLDER :
207208 const workspaceFolders = this . contextService . getWorkspace ( ) . folders . map ( root => root . uri . fsPath ) ;
208- return this . windowService . createAndOpenWorkspace ( workspaceFolders , configPath ) ;
209+ return this . workspaceEditingService . createAndOpenWorkspace ( workspaceFolders , configPath ) ;
209210
210211 case WorkbenchState . WORKSPACE :
211- return this . windowService . saveAndOpenWorkspace ( configPath ) ;
212+ return this . workspaceEditingService . saveAndOpenWorkspace ( configPath ) ;
212213 }
213214 }
214215
0 commit comments