void updateCachedStateIfNeeded() {
    if (!ApplicationManager.getApplication().isDispatchThread()) return;
    int modelCounter = myCaretModel.myDocumentUpdateCounter;
    if (myDocumentUpdateCounter != modelCounter) {
      updateCachedState();
      myDocumentUpdateCounter = modelCounter;
    }
  }
void updateCachedStateIfNeeded()