@@ -40,6 +40,9 @@ define(function (require, exports, module) {
4040 Strings . CLOSE_ALL_TABS ,
4141 Strings . CLOSE_UNMODIFIED_TABS ,
4242 "---" ,
43+ Strings . RENAME_TAB_FILE ,
44+ Strings . DELETE_TAB_FILE ,
45+ "---" ,
4346 Strings . REOPEN_CLOSED_FILE
4447 ] ;
4548
@@ -219,6 +222,43 @@ define(function (require, exports, module) {
219222 }
220223
221224
225+ /**
226+ * "RENAME FILE"
227+ * This function handles the renaming of the file that was right-clicked
228+ *
229+ * @param {String } filePath - path of the file to rename
230+ */
231+ function handleFileRename ( filePath ) {
232+ if ( filePath ) {
233+ // First ensure the sidebar is visible so users can see the rename action
234+ CommandManager . execute ( Commands . SHOW_SIDEBAR ) ;
235+
236+ // Get the file object using FileSystem
237+ const fileObj = FileSystem . getFileForPath ( filePath ) ;
238+
239+ // Execute the rename command with the file object
240+ CommandManager . execute ( Commands . FILE_RENAME , { file : fileObj } ) ;
241+ }
242+ }
243+
244+
245+ /**
246+ * "DELETE FILE"
247+ * This function handles the deletion of the file that was right-clicked
248+ *
249+ * @param {String } filePath - path of the file to delete
250+ */
251+ function handleFileDelete ( filePath ) {
252+ if ( filePath ) {
253+ // Get the file object using FileSystem
254+ const fileObj = FileSystem . getFileForPath ( filePath ) ;
255+
256+ // Execute the delete command with the file object
257+ CommandManager . execute ( Commands . FILE_DELETE , { file : fileObj } ) ;
258+ }
259+ }
260+
261+
222262 /**
223263 * This function is called when a tab is right-clicked
224264 * This will show the more options context menu
@@ -279,6 +319,12 @@ define(function (require, exports, module) {
279319 case Strings . CLOSE_UNMODIFIED_TABS :
280320 handleCloseUnmodifiedTabs ( paneId ) ;
281321 break ;
322+ case Strings . RENAME_TAB_FILE :
323+ handleFileRename ( filePath ) ;
324+ break ;
325+ case Strings . DELETE_TAB_FILE :
326+ handleFileDelete ( filePath ) ;
327+ break ;
282328 case Strings . REOPEN_CLOSED_FILE :
283329 reopenClosedFile ( ) ;
284330 break ;
0 commit comments