EditorTabColorProvider not called at startup
Answered
I use an implementation of EditorTabColorProvider to colorize tabs that contain Java Swing controls. This is working well when I open a new tab. But when I close IntelliJ and restart it, the coloring is gone and only comes back, when I reopen the tabs.
I did set a breakpoint and saw that the method "getEditorTabColor" never gets called at startup, only when manually opening a file.
This is how I register my provider:
<editorTabColorProvider implementation="Tcp" order="first" />
How can I restore coloring at startup without having to reopen all tabs?
Please sign in to leave a comment.
Please clarify how you do achieve "that contain Java Swing controls" in your implementation. The problem could maybe be solved by implementing com.intellij.openapi.project.DumbAware additionally, but then you must not access indexes in your implementation.
Here is the relevant part of my code:
Please try
Then it throws an IndexNotReadyException when calling InheritanceUtil.getSuperClasses()
OK, I see. While DumbService.isDumb(project) you should return null
Then I'm back at my original problem. The initial call will return immediately because Index is not loaded yet and it does not get called any more until I close and reopen the Tab.
Is there any way to force the editor to call the color provider? Then I could register a listerner which is fired when the project is loaded and manually call the colorizing process
Our own implementations don't depend on indexes. Unfortunately there is no "direct" listener but there are two reasons to update background color:
Sure we should update background color just after indexes are build (https://youtrack.jetbrains.com/issue/IDEA-263296)
Update: IDEA-263296 is fixed in master branch. This example works for me:
Wow, that was fixed quickly. Thank you.