How to trigger annotator without changing file?
I need to trigger the annotation engine to be carried out again on my entire editor document, without having the file changed.
Needed scenario:
My document annotator is directly depending on data provided through a jdbc layer from the database.
I may change the current database connection from a toolbar dropdown.
When I switch to another connection, I want the annotator to rerun on the active document.
I currently use a dirty workaround for this, which I do not really want to mention here... ;)
Please sign in to leave a comment.
DaemonCodeAnalyser.getInstance(project).restart() should work, even though it's quite a brute force approach ;)
Sascha
Thanks Sascha!
What's the scope of the analyzer? Is it the current document or all currently opened documents?
And what non-openAPI jar is containing it?
btw...
found http://intellij.net/forums/thread.jspa;?messageID=5112057? and http://www.jetbrains.net/jira/browse/IDEA-7297
;)
Looks like there is no other reasonable way to do this...
I believe the restart causes all files that belong to the project to be re-analysed. You need to add idea.jar to your IDEA-JDK to make use of it.
Sascha
idea.jar was already in my library list.
spelling of ..Analyzer was wrong (..Analiser) :)
Thanks a lot! This works. It looks like it annotates only the current file, and this is exactly what I needed. Hope I am not wrong about that...
... was wrong... :( this is resetting the annotators. The current editor is re-annotated and all other editors will be annotated when made current.
Found a more "lighter" method that serves my purpose:
DaemonCodeAnalyzer.getInstance(project).updateVisibleHighlighters(editor)
this is triggering (among others) reloading gutter action "Presentable" and re-resolving the PsiReferences.... which is all I need :)