Is there a way to rename the file in Editor Window but not in File System?

Answered

I came across a requirement where a file is created in File System having a timestamp in name (for Ex: 1630684117.demo), The file is registered in FileEditorProvider and it opened in custom FileEditor with FileEditorPolicy set to HIDE_DEFAULT_EDITOR.

Here in Editor Window Tab, I want to show a user friendly name of the file (i.e. show "Report of 2021-09-03 19:00" instead of 1630684117.demo ), but I don't want to rename original file in File System.


I tried FileEditor.getName(), but it can set name of File tab shown at the bottom of Editor if PLACE_AFTER_DEFAULT_EDITOR or PLACE_BEFORE_DEFAULT_EDITOR FileEditorPolicy is used. I want to rename the file virtually without affecting original file, is it possible?

Any help to achieve this requirement is much appreciated,

Thank You....

2 comments
Comment actions Permalink

See com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider extension point to custmize filename shown in editor tab.

1
Comment actions Permalink

It worked perfectly, Thank you.

0

Please sign in to leave a comment.