@@ -65,12 +65,6 @@ define(function (require, exports, module) {
6565 }
6666 }
6767
68- // **Close**
69- // closes the right-clicked tab
70- function handleCloseTab ( ) {
71- _executeWithFileContext ( Commands . FILE_CLOSE , { paneId : _currentTabContext . paneId } ) ;
72- }
73-
7468 // **Close All Tabs**
7569 // closes all tabs in the pane where the tab was right-clicked
7670 function handleCloseAllTabs ( ) {
@@ -120,27 +114,6 @@ define(function (require, exports, module) {
120114 }
121115 }
122116
123- // **Rename**
124- // renames the right-clicked tab's file
125- function handleFileRename ( ) {
126- CommandManager . execute ( Commands . SHOW_SIDEBAR ) ;
127- _executeWithFileContext ( Commands . FILE_RENAME ) ;
128- }
129-
130- // **Delete**
131- // deletes the right-clicked tab's file
132- function handleFileDelete ( ) {
133- _executeWithFileContext ( Commands . FILE_DELETE ) ;
134- }
135-
136- // **Show in File Tree**
137- // shows the right-clicked tab's file in the file tree
138- function handleShowInFileTree ( ) {
139- CommandManager . execute ( Commands . SHOW_SIDEBAR ) ;
140- _executeWithFileContext ( Commands . NAVIGATE_SHOW_IN_FILE_TREE ) ;
141- }
142-
143-
144117 /**
145118 * this function is called from Tabbar/main.js when a tab is right clicked
146119 * it is responsible to show the context menu and also set the currentTabContext
@@ -183,30 +156,6 @@ define(function (require, exports, module) {
183156 menu . addMenuItem ( Commands . NAVIGATE_SHOW_IN_FILE_TREE ) ;
184157 menu . addMenuDivider ( ) ;
185158 menu . addMenuItem ( Commands . FILE_REOPEN_CLOSED ) ;
186-
187- // intercept clicks on existing commands
188- // this is done so that we can inject the right-clicked tab's context
189- menu . on ( "beforeContextMenuOpen" , function ( ) {
190- const $menu = $ ( `#${ menu . id } > ul` ) ;
191- if ( ! $menu . length ) { return ; }
192-
193- // for other commands, we have built-in context as those are our custom functions
194- const interceptors = [
195- [ Commands . FILE_CLOSE , handleCloseTab ] ,
196- [ Commands . FILE_RENAME , handleFileRename ] ,
197- [ Commands . FILE_DELETE , handleFileDelete ] ,
198- [ Commands . NAVIGATE_SHOW_IN_FILE_TREE , handleShowInFileTree ]
199- ] ;
200-
201- interceptors . forEach ( ( [ commandId , handler ] ) => {
202- $menu . find ( `a[data-command="${ commandId } "]` ) . off ( "click" ) . on ( "click" , function ( e ) {
203- e . stopPropagation ( ) ;
204- e . preventDefault ( ) ;
205- handler ( ) ;
206- menu . close ( ) ;
207- } ) ;
208- } ) ;
209- } ) ;
210159 }
211160
212161 module . exports = {
0 commit comments