How to change order of files in Project View

I am developing plugin for Intellij Idea that will be used by consultants in my company and I need to achieve this:

In case project contains folder with some specific name, I need to show the files in it not sorted alphabetically, but based on different order (order is controlled by JSON file located at the same level like the folder itself).

 

What is the most easy way? Files in the folder are either Groovy files or generic Text files and I still want the folder to support actions such as "Find in path", "Replace in path" etc..

I am able to achieve what I need by using custom TreeStructureProvider that removes original folder (PsiDirectoryNode) and instead creates custom ProjectViewNode and creates nodes for virtual files in it... BUT the problem is that in the context menu of this custom ProjectViewNode, I am missing many useful actions that are by default present on node that is representing normal folder...

What is the easiest way?

Please sign in to leave a comment.