Disable and enable ExternalAnnotator

已回答

Hello,

 

I implemented ExternalAnnotator for my project. In some cases it must be disabled. My ProjectComponent implementation check conditions and if needed it disable annotator extension via 

extensionPoint.unregisterExtension(...)

But if user switch to other project (or open several projects in different window) annotator can be still disabled.

 

What is best solution for this? Use flag in ProjectComponent and check this flag in annotator?

 

Thanks in advance!

 

Best regards,

Aleks.

0

Hi,

I'd rather check & cache the conditions in `com.intellij.lang.annotation.ExternalAnnotator#collectInformation(com.intellij.psi.PsiFile)`? Depending on the condition you need an event to clear cache but you need it for current solution as well, so I suspect that you have it.

Anna

0

Hi Anna,


Thank you for response. I really appreciate it!

 

My question is not about cache but about disable and enable extensions (ExternalAnnotator extension as well). Maybe you can suggest some solution for this(enable and disable extensions)?

 

Best regards,

Aleks.

0

I don't understand how you want your code to operate. Do you want user to enable/disable your external annotator? If so, I'd suggest to use bounded inspection, see `com.intellij.codeInspection.javaDoc.JavadocHtmlLintInspection`. If you want to act on some other conditions, then I suggest to check these conditions in the annotator and do not enable/disable extensions as enabling/disabling of application level extensions work for the whole IDEA instance, not per-project.

1

Hi Anna,

 

Thank you for this very important clarifications! For my task it will be better to check conditions in annotator. You mentioned important information:

 

"do not enable/disable extensions as enabling/disabling of application level extensions work for the whole IDEA instance, not per-project"

 

Thank you for help!

Best regards,

Aleks.

0

请先登录再写评论。