Unregistering a file type not getting applied


For my plugin I need to be able to dynamically unregister a file type during runtime. I have tried using all the different methods(unregister.. and remove.. methods) in the FileManger singleton.

It seems to have worked in some isolated cases in the past. I do not get any errors and the disabled state is getting set because if I stop and restart IDEA the disabled setting is there and the syntax highlighting on that file type is not happening.

Is there maybe some other call I need to make so that the change in file types is applied to the running application?



It not goot to unregister file types. Just create your own with patterns you needed, if it allowed, then your file type withh override standard one. But if it not alowed - you will get no ride.


What I am currently doing is as follows:

-Upon loading my plug-in registers a file type for *.txt file. This replaces the PlainTextFileType that is registered by default. I don't unregister anything.
-Since I am overriding a common file type I do not want to impose this on the user. So I have added a configuration panel where the syntax highlighting can be turned off when not wanted. disabling in the config panel should remove the file type registering
-"Disabling" works but it requires an IDEA restart so that the change is picked-up.
- Enabling is picked-up without having to restart

So in the end I am able to change the default file type to my custom file type but I can not remove my own file-type to return the default one.

And I have this problem whether or not I unregister old then register new or simply register the new and expecting the old to be over-written.

What I would like to understand is why I can over-ride the file type once but not more?



Please sign in to leave a comment.