@@ -28,15 +28,13 @@ define(function (require, exports, module) {
2828 const CommandManager = require ( "command/CommandManager" ) ;
2929 const Commands = require ( "command/Commands" ) ;
3030 const FileSystem = require ( "filesystem/FileSystem" ) ;
31- const MainViewManager = require ( "view/MainViewManager" ) ;
3231
3332 const Global = require ( "./global" ) ;
3433
3534 // List of items to show in the context menu
3635 // Strings defined in `src/nls/root/strings.js`
3736 const items = [
3837 Strings . CLOSE_TAB ,
39- Strings . CLOSE_ACTIVE_TAB ,
4038 Strings . CLOSE_TABS_TO_THE_LEFT ,
4139 Strings . CLOSE_TABS_TO_THE_RIGHT ,
4240 Strings . CLOSE_ALL_TABS ,
@@ -247,8 +245,8 @@ define(function (require, exports, module) {
247245 dropdown . showDropdown ( ) ;
248246
249247 // handle the option selection
250- dropdown . on ( "select" , function ( e , item , index ) {
251- _handleSelection ( index , filePath , paneId ) ;
248+ dropdown . on ( "select" , function ( e , item ) {
249+ _handleSelection ( item , filePath , paneId ) ;
252250 } ) ;
253251
254252 // Remove the button after the dropdown is hidden
@@ -260,40 +258,30 @@ define(function (require, exports, module) {
260258 /**
261259 * Handles the selection of an option in the more options context menu
262260 *
263- * @param {Number } index - the index of the selected option
261+ * @param {String } item - the item being selected
264262 * @param {String } filePath - the path of the file that was right-clicked
265263 * @param {String } paneId - the id of the pane ["first-pane", "second-pane"]
266264 */
267- function _handleSelection ( index , filePath , paneId ) {
268- switch ( index ) {
269- case 0 :
270- // Close tab (the one that was right-clicked)
271- handleCloseTab ( filePath , paneId ) ;
272- break ;
273- case 1 :
274- // Close active tab
275- handleCloseActiveTab ( ) ;
276- break ;
277- case 2 :
278- // Close tabs to the left
279- handleCloseTabsToTheLeft ( filePath , paneId ) ;
280- break ;
281- case 3 :
282- // Close tabs to the right
283- handleCloseTabsToTheRight ( filePath , paneId ) ;
284- break ;
285- case 4 :
286- // Close all tabs
287- handleCloseAllTabs ( paneId ) ;
288- break ;
289- case 5 :
290- // Close unmodified tabs
291- handleCloseUnmodifiedTabs ( paneId ) ;
292- break ;
293- case 6 :
294- // Reopen closed file
295- reopenClosedFile ( ) ;
296- break ;
265+ function _handleSelection ( item , filePath , paneId ) {
266+ switch ( item ) {
267+ case Strings . CLOSE_TAB :
268+ handleCloseTab ( filePath , paneId ) ;
269+ break ;
270+ case Strings . CLOSE_TABS_TO_THE_LEFT :
271+ handleCloseTabsToTheLeft ( filePath , paneId ) ;
272+ break ;
273+ case Strings . CLOSE_TABS_TO_THE_RIGHT :
274+ handleCloseTabsToTheRight ( filePath , paneId ) ;
275+ break ;
276+ case Strings . CLOSE_ALL_TABS :
277+ handleCloseAllTabs ( paneId ) ;
278+ break ;
279+ case Strings . CLOSE_UNMODIFIED_TABS :
280+ handleCloseUnmodifiedTabs ( paneId ) ;
281+ break ;
282+ case Strings . REOPEN_CLOSED_FILE :
283+ reopenClosedFile ( ) ;
284+ break ;
297285 }
298286 }
299287
0 commit comments