I can get the VirtualFile that I currently switched to (any source file opened in a project in IntelliJ IDEA).
I use the getName() method to get the file name (without the path), and display it in my plugin.
If I open a database tool window and double-click a connection (say, MySQL), I will get a new editor with a file, where I can write some DB requests. Turns out that the file is actually a scratch file. If I get its name the same way I did previously, I receive a very long name. getPresentableName() returns the same long name.
However, the editor tab for this file shows a short name (usually the name of the DB connection).
Is there a way I can obtain the name of the scratch as displayed in the tab?