public static void addToInvokeLater(final Runnable runnable){
  final Application application=ApplicationManager.getApplication();
  if (application.isHeadlessEnvironment() && !application.isUnitTestMode()) {
    runnable.run();
  }
 else {
    UIUtil.invokeLaterIfNeeded(runnable);
  }
}

public static void addToInvokeLater ( final Runnable runnable ) { final Application application = ApplicationManager . getApplication ( ) ; if ( application . isHeadlessEnvironment ( ) && ! application . isUnitTestMode ( ) ) { runnable . run ( ) ; } else { UIUtil . invokeLaterIfNeeded ( runnable ) ; } }
adds runnable to event dispatch queue if we aren ' t in unittest of headless environment mode
