@@ -106,27 +106,7 @@ export class SketchbookWidgetContribution
106
106
this . revealSketchNode ( treeWidgetId , nodeId ) ,
107
107
} ) ;
108
108
registry . registerCommand ( SketchbookCommands . OPEN_NEW_WINDOW , {
109
- execute : ( arg ) => {
110
- const widget = this . tryGetWidget ( ) ;
111
- if ( widget ) {
112
- const treeWidgetId = widget . activeTreeWidgetId ( ) ;
113
- if ( ! treeWidgetId ) {
114
- console . warn ( `Could not retrieve active sketchbook tree ID.` ) ;
115
- return ;
116
- }
117
- const nodeId = arg . node . id ;
118
- const options : WorkspaceInput = { } ;
119
- Object . assign ( options , {
120
- tasks : [
121
- {
122
- command : SketchbookCommands . REVEAL_SKETCH_NODE . id ,
123
- args : [ treeWidgetId , nodeId ] ,
124
- } ,
125
- ] ,
126
- } ) ;
127
- return this . workspaceService . open ( arg . node . uri , options ) ;
128
- }
129
- } ,
109
+ execute : ( arg ) => this . openNewWindow ( arg . node ) ,
130
110
isEnabled : ( arg ) =>
131
111
! ! arg && 'node' in arg && SketchbookTree . SketchDirNode . is ( arg . node ) ,
132
112
isVisible : ( arg ) =>
@@ -229,6 +209,28 @@ export class SketchbookWidgetContribution
229
209
} ) ;
230
210
}
231
211
212
+ private openNewWindow ( node : SketchbookTree . SketchDirNode ) : void {
213
+ const widget = this . tryGetWidget ( ) ;
214
+ if ( widget ) {
215
+ const treeWidgetId = widget . activeTreeWidgetId ( ) ;
216
+ if ( ! treeWidgetId ) {
217
+ console . warn ( `Could not retrieve active sketchbook tree ID.` ) ;
218
+ return ;
219
+ }
220
+ const nodeId = node . id ;
221
+ const options : WorkspaceInput = { } ;
222
+ Object . assign ( options , {
223
+ tasks : [
224
+ {
225
+ command : SketchbookCommands . REVEAL_SKETCH_NODE . id ,
226
+ args : [ treeWidgetId , nodeId ] ,
227
+ } ,
228
+ ] ,
229
+ } ) ;
230
+ return this . workspaceService . open ( node . uri , options ) ;
231
+ }
232
+ }
233
+
232
234
/**
233
235
* Reveals and selects node in the file navigator to which given widget is related.
234
236
* Does nothing if given widget undefined or doesn't have related resource.
0 commit comments