public synchronized void runPostStartupActivities() {
    final Application app = ApplicationManager.getApplication();
    app.assertIsDispatchThread();

    if (myPostStartupActivitiesPassed) return;

    runActivities(myDumbAwarePostStartupActivities);
    DumbService.getInstance(myProject)
        .runWhenSmart(
            new Runnable() {
              public void run() {
                synchronized (StartupManagerImpl.this) {
                  app.assertIsDispatchThread();
                  if (myProject.isDisposed()) return;
                  runActivities(
                      myDumbAwarePostStartupActivities); // they can register activities while in
                                                         // the dumb mode
                  runActivities(myNotDumbAwarePostStartupActivities);

                  myPostStartupActivitiesPassed = true;
                }
              }
            });

    if (!app.isUnitTestMode()) {
      VirtualFileManager.getInstance().refresh(!app.isHeadlessEnvironment());
    }
  }
  public void runPostStartupActivities() {
    if (postStartupActivityPassed()) {
      return;
    }

    final Application app = ApplicationManager.getApplication();

    if (!app.isHeadlessEnvironment()) {
      checkFsSanity();
      checkProjectRoots();
    }

    runActivities(myDumbAwarePostStartupActivities);

    DumbService.getInstance(myProject)
        .runWhenSmart(
            new Runnable() {
              @Override
              public void run() {
                app.assertIsDispatchThread();

                // myDumbAwarePostStartupActivities might be non-empty if new activities were
                // registered during dumb mode
                runActivities(myDumbAwarePostStartupActivities);

                //noinspection SynchronizeOnThis
                synchronized (StartupManagerImpl.this) {
                  if (!myNotDumbAwarePostStartupActivities.isEmpty()) {
                    while (!myNotDumbAwarePostStartupActivities.isEmpty()) {
                      queueSmartModeActivity(myNotDumbAwarePostStartupActivities.remove(0));
                    }

                    // return here later to set myPostStartupActivitiesPassed
                    DumbService.getInstance(myProject).runWhenSmart(this);
                  } else {
                    myPostStartupActivitiesPassed = true;
                  }
                }
              }
            });

    // otherwise will be stored - we must not create config files in tests
    if (!app.isUnitTestMode()) {
      Registry.get("ide.firstStartup").setValue(false);
    }
  }