@@ -20,7 +20,7 @@ import errors = require('vs/base/common/errors');
2020import * as DOM from 'vs/base/browser/dom' ;
2121import { StandardMouseEvent } from 'vs/base/browser/mouseEvent' ;
2222import { CONTEXT as ToolBarContext , ToolBar } from 'vs/base/browser/ui/toolbar/toolbar' ;
23- import { IActionItem , ActionsOrientation , Separator } from 'vs/base/browser/ui/actionbar/actionbar' ;
23+ import { IActionItem , ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar' ;
2424import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar' ;
2525import { IActionBarRegistry , Extensions , prepareActions } from 'vs/workbench/browser/actions' ;
2626import { Action , IAction } from 'vs/base/common/actions' ;
@@ -39,7 +39,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
3939import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
4040import { IThemeService } from 'vs/platform/theme/common/themeService' ;
4141import { attachProgressBarStyler } from 'vs/platform/theme/common/styler' ;
42- import { ToggleSidebarVisibilityAction } from 'vs/workbench/browser/actions/toggleSidebarVisibility' ;
4342
4443export interface ICompositeTitleLabel {
4544
@@ -429,7 +428,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
429428 'class' : [ 'composite' , 'title' ]
430429 } ) ;
431430
432- $ ( titleArea ) . on ( DOM . EventType . CONTEXT_MENU , ( e : MouseEvent ) => this . onContextMenu ( new StandardMouseEvent ( e ) ) ) ;
431+ $ ( titleArea ) . on ( DOM . EventType . CONTEXT_MENU , ( e : MouseEvent ) => this . onTitleAreaContextMenu ( new StandardMouseEvent ( e ) ) ) ;
433432
434433 // Left Title Label
435434 this . titleLabel = this . createTitleLabel ( titleArea ) ;
@@ -477,31 +476,24 @@ export abstract class CompositePart<T extends Composite> extends Part {
477476 this . titleLabel . updateStyles ( ) ;
478477 }
479478
480- private onContextMenu ( event : StandardMouseEvent ) : void {
481- const contextMenuActions = this . activeComposite ? this . activeComposite . getContextMenuActions ( ) : [ ] ;
482- if ( contextMenuActions . length ) {
483- contextMenuActions . push ( new Separator ( ) ) ;
484- }
485- contextMenuActions . push ( this . createHideSideBarAction ( ) ) ;
486- if ( contextMenuActions . length ) {
487- let anchor : { x : number , y : number } = { x : event . posx , y : event . posy } ;
488- this . contextMenuService . showContextMenu ( {
489- getAnchor : ( ) => anchor ,
490- getActions : ( ) => TPromise . as ( contextMenuActions ) ,
491- getActionItem : ( action : Action ) => this . actionItemProvider ( action ) ,
492- actionRunner : this . activeComposite . getActionRunner ( ) ,
493- getKeyBinding : ( action ) => this . keybindingService . lookupKeybinding ( action . id )
494- } ) ;
479+ private onTitleAreaContextMenu ( event : StandardMouseEvent ) : void {
480+ if ( this . activeComposite ) {
481+ const contextMenuActions = this . getTitleAreaContextMenuActions ( ) ;
482+ if ( contextMenuActions . length ) {
483+ let anchor : { x : number , y : number } = { x : event . posx , y : event . posy } ;
484+ this . contextMenuService . showContextMenu ( {
485+ getAnchor : ( ) => anchor ,
486+ getActions : ( ) => TPromise . as ( contextMenuActions ) ,
487+ getActionItem : ( action : Action ) => this . actionItemProvider ( action ) ,
488+ actionRunner : this . activeComposite . getActionRunner ( ) ,
489+ getKeyBinding : ( action ) => this . keybindingService . lookupKeybinding ( action . id )
490+ } ) ;
491+ }
495492 }
496493 }
497494
498- private createHideSideBarAction ( ) : IAction {
499- return < IAction > {
500- id : ToggleSidebarVisibilityAction . ID ,
501- label : nls . localize ( 'compositePart.hideSideBarLabel' , "Hide Side Bar" ) ,
502- enabled : true ,
503- run : ( ) => this . partService . setSideBarHidden ( true )
504- } ;
495+ protected getTitleAreaContextMenuActions ( ) : IAction [ ] {
496+ return this . activeComposite ? this . activeComposite . getContextMenuActions ( ) : [ ] ;
505497 }
506498
507499 private actionItemProvider ( action : Action ) : IActionItem {
0 commit comments