private boolean isUnderMouseCursor() {
    if (ApplicationManager.getApplication().isUnitTestMode() || 
        ApplicationManager.getApplication().isHeadlessEnvironment()) return false;
    try {
      return getMousePosition() != null;
    }
    catch (NullPointerException e) { // A workaround for https://bugs.openjdk.org/browse/JDK-6840067
      return false;
    }
  }
private boolean isUnderMouseCursor()