How to manually set Icon of a file.
For an example : I have a plugin where multiple users can connect and edit the files in the same project. I want to show a dot on top of icons of files currently accessed by other users.
I implemented IconProvider but it doesn't do the job for me. IconProvider gets called only when IDEA wants it to. Is there any way to manually set the icon for files?
Please sign in to leave a comment.
When the state of a file changes, you can ask IntelliJ IDEA to refresh its presentation (icon, colors etc.) by calling FileEditorManagerEx.updateFilePresentation().
Hi Dimitry, I tried it as shown in code below. When I run it for the first time getIcon() gets triggered. But after that it doesn't get triggered until some change is done to the file. Am I doing it wrong or is there any other way to refresh the icons whenever needed to?
As I mentioned earlier my primary requirement is to show a dot on top of file icons when a file is currently opened by a remote user and remove the dot when the remote user closes the file.
Hi Dmitry,
unfortunately we could not get the feature to work yet. Is it possible at all to trigger the update of an Icon that is not opened in an editor? The method you mentioned (
Also there seem to be rules how icons are cached or not, even if you reopen editors and the like.
Is there a way I can trigger an update of the project view?
Is it necessary to override PresentationData?