code: protected void runOnGUIThreadIfExistsOtherwiseRunDirect(Runnable runnable) {
          if(getTextGUI() != null && getTextGUI().getGUIThread() != null) {
              getTextGUI().getGUIThread().invokeLater(runnable);
          }
          else {
              runnable.run();
          }
      }
docs: Takes a {@code Runnable} and immediately executes it if this is called on the designated GUI thread, otherwise
  schedules it for later invocation.
  @param runnable {@code Runnable} to execute on the GUI thread