void enqueFileChange(const core::system::FileChangeEvent& event)
   {
      // screen out files which don't pass the filter
      if (!filter_(event.fileInfo()))
         return;

      // add to the queue
      queue_.push(event);

      // schedule processing
      scheduleProcessing(incrementalWorkPeriod_);
   }
   void enqueFileChange(const core::system::FileChangeEvent& event)
   {
      // screen out files which don't pass the filter
      if (!filter_(event.fileInfo()))
         return;

      // add to the queue
      queue_.push(event);

      // schedule processing if necessary. don't process anything immediately
      // (this is to defend against large numbers of files being enqued
      // at once and typing up the main thread). rather, schedule processing
      // to occur in incrementalWorkPeriod_ chunks
      if (!processing_)
      {
         processing_ = true;

         module_context::scheduleIncrementalWork(
             incrementalWorkPeriod_,
             boost::bind(&IncrementalFileChangeHandler::dequeAndProcess, this),
             idleOnly_);
      }
   }
Exemplo n.º 3
0
void UserSettings::onSettingsFileChanged(
                     const core::system::FileChangeEvent& changeEvent)
{
   // ensure this is for our target file
   if (settingsFilePath_.absolutePath() !=
       changeEvent.fileInfo().absolutePath())
   {
      return;
   }

   // re-read the settings from disk
   Error error = settings_.initialize(settingsFilePath_);
   if (error)
   {
      LOG_ERROR(error);
      return;
   }

   // update prefs cache
   updatePrefsCache(uiPrefs());

   // set underlying R repos options
   std::string cranMirrorURL = cranMirror().url;
   if (!cranMirrorURL.empty())
      setCRANReposOption(cranMirrorURL);
   std::string bioconductorMirrorURL = settings_.get(kBioconductorMirrorUrl);
   if (!bioconductorMirrorURL.empty())
      setBioconductorReposOption(bioconductorMirrorURL);

   // update remove dups in underlying R session
   using namespace r::session;
   consoleHistory().setRemoveDuplicates(removeHistoryDuplicates());

   // fire event so others can react appropriately
   onChanged();
}