Is there a way to find out Indexer is still running except an exception?


I'm trying using different index-based methods in my plugin but sometimes it drops out with this exception:


This results in bad user experience for my users 'cause functionion of the plugin is not reliable and I need to display inconsistent state somehow. I wish there'd be a way just to ask if indexer is still running  - then I would just do not display content at all. 


IndexNotReadyException is thrown from the inside of in case you're still in Dumb mode. Before performing your action, check if IDE is not in Dumb mode anymore: