@@ -27,6 +27,7 @@ import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/plat
2727import { INotificationService } from 'vs/platform/notification/common/notification' ;
2828import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet' ;
2929import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService' ;
30+ import { IPanelService } from 'vs/workbench/services/panel/common/panelService' ;
3031
3132const registry = Registry . as < IWorkbenchActionRegistry > ( WorkbenchExtensions . WorkbenchActions ) ;
3233const viewCategory = nls . localize ( 'view' , "View" ) ;
@@ -518,7 +519,7 @@ export class MoveFocusedViewAction extends Action {
518519 @IContextKeyService private contextKeyService : IContextKeyService ,
519520 @INotificationService private notificationService : INotificationService ,
520521 @IActivityBarService private activityBarService : IActivityBarService ,
521- @IViewletService private viewletService : IViewletService
522+ @IPanelService private panelService : IPanelService
522523 ) {
523524 super ( id , label ) ;
524525 }
@@ -542,36 +543,58 @@ export class MoveFocusedViewAction extends Action {
542543 const quickPick = this . quickInputService . createQuickPick ( ) ;
543544 quickPick . placeholder = nls . localize ( 'moveFocusedView.selectDestination' , "Select a Destination for the View" ) ;
544545
546+ const items : Array < IQuickPickItem | IQuickPickSeparator > = [ ] ;
547+
548+ items . push ( {
549+ type : 'separator' ,
550+ label : nls . localize ( 'sidebar' , "Side Bar" )
551+ } ) ;
552+
553+ items . push ( {
554+ id : '_.sidebar.newcontainer' ,
555+ label : nls . localize ( 'moveFocusedView.newContainerInSidebar' , "New Container in Side Bar" )
556+ } ) ;
557+
545558 const pinnedViewlets = this . activityBarService . getPinnedViewletIds ( ) ;
546- const items : Array < IQuickPickItem | IQuickPickSeparator > = this . viewletService . getViewlets ( )
547- . filter ( viewlet => {
548- if ( viewlet . id === this . viewDescriptorService . getViewContainer ( focusedViewId ) ! . id ) {
559+ items . push ( ... pinnedViewlets
560+ . filter ( viewletId => {
561+ if ( viewletId === this . viewDescriptorService . getViewContainer ( focusedViewId ) ! . id ) {
549562 return false ;
550563 }
551564
552- return ! viewContainerRegistry . get ( viewlet . id ) ! . rejectAddedViews && pinnedViewlets . indexOf ( viewlet . id ) !== - 1 ;
565+ return ! viewContainerRegistry . get ( viewletId ) ! . rejectAddedViews ;
553566 } )
554- . map ( viewlet => {
567+ . map ( viewletId => {
555568 return {
556- id : viewlet . id ,
557- label : viewlet . name ,
569+ id : viewletId ,
570+ label : viewContainerRegistry . get ( viewletId ) ! . name
558571 } ;
559- } ) ;
572+ } ) ) ;
560573
561- if ( this . viewDescriptorService . getViewLocation ( focusedViewId ) !== ViewContainerLocation . Panel ) {
562- items . unshift ( {
563- type : 'separator' ,
564- label : nls . localize ( 'sidebar' , "Side Bar" )
565- } ) ;
566- items . push ( {
567- type : 'separator' ,
568- label : nls . localize ( 'panel' , "Panel" )
569- } ) ;
570- items . push ( {
571- id : '_.panel.newcontainer' ,
572- label : nls . localize ( 'moveFocusedView.newContainerInPanel' , "New Container in Panel" ) ,
573- } ) ;
574- }
574+ items . push ( {
575+ type : 'separator' ,
576+ label : nls . localize ( 'panel' , "Panel" )
577+ } ) ;
578+ items . push ( {
579+ id : '_.panel.newcontainer' ,
580+ label : nls . localize ( 'moveFocusedView.newContainerInPanel' , "New Container in Panel" ) ,
581+ } ) ;
582+
583+ const pinnedPanels = this . panelService . getPinnedPanels ( ) ;
584+ items . push ( ...pinnedPanels
585+ . filter ( panel => {
586+ if ( panel . id === this . viewDescriptorService . getViewContainer ( focusedViewId ) ! . id ) {
587+ return false ;
588+ }
589+
590+ return ! viewContainerRegistry . get ( panel . id ) ! . rejectAddedViews ;
591+ } )
592+ . map ( panel => {
593+ return {
594+ id : panel . id ,
595+ label : viewContainerRegistry . get ( panel . id ) ! . name
596+ } ;
597+ } ) ) ;
575598
576599 quickPick . items = items ;
577600
@@ -581,6 +604,9 @@ export class MoveFocusedViewAction extends Action {
581604 if ( destination . id === '_.panel.newcontainer' ) {
582605 this . viewDescriptorService . moveViewToLocation ( viewDescriptor ! , ViewContainerLocation . Panel ) ;
583606 this . viewsService . openView ( focusedViewId , true ) ;
607+ } else if ( destination . id === '_.sidebar.newcontainer' ) {
608+ this . viewDescriptorService . moveViewToLocation ( viewDescriptor ! , ViewContainerLocation . Sidebar ) ;
609+ this . viewsService . openView ( focusedViewId , true ) ;
584610 } else if ( destination . id ) {
585611 this . viewDescriptorService . moveViewsToContainer ( [ viewDescriptor ] , viewContainerRegistry . get ( destination . id ) ! ) ;
586612 this . viewsService . openView ( focusedViewId , true ) ;
0 commit comments