@Override
        public void beforeModalityStateChanged(boolean entering, @NotNull Object modalEntity) {
          if (entering) {
            suspend();
          }
          else {
            resume();
          }
        }
@Override
        public void beforeModalityStateChanged(boolean entering, @NotNull Object modalEntity)