public int FDoIdle(uint grfidlef)
        {
            CocoLanguageService pl = GetService(typeof(CocoLanguageService)) as CocoLanguageService;
            bool periodic          = (grfidlef & (uint)_OLEIDLEF.oleidlefPeriodic) != 0;

            if (pl != null)
            {
                pl.OnIdle(periodic);
            }
            if (periodic && null != libraryManager)   //it is WANTED that the library only runs periodicly
            {
                libraryManager.OnIdle();
            }
            return(0);
        }
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            IServiceContainer serviceContainer = (IServiceContainer)this;

            //add languageservice
            languageService = new CocoLanguageService();
            languageService.SetSite(this);
            serviceContainer.AddService(typeof(CocoLanguageService), languageService, true);

            //add library
            libraryManager = new CocoLibraryManager(this);
            serviceContainer.AddService(typeof(CocoLibraryManager), libraryManager, true);

            //this is necessary because the Initialize method of the packages is called AFTER a solution that contains a grammar-file has been opened, so the Solution.Opened event won't be reaised anymore
            RegisterSolution();

            //checks periodically if files have changed (and rebuilds the library)
            RegisterForIdleTime();

            // Add build event handlers
            DTE2 dte = (DTE2)GetService(typeof(DTE));

            buildEvents = dte.Events.BuildEvents;
            buildEvents.OnBuildBegin += OnBuildBegin;
            buildEvents.OnBuildDone  += OnBuildDone;

            //add solution events
            solutionEvents                 = dte.Events.SolutionEvents;
            solutionEvents.Opened         += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
            solutionEvents.BeforeClosing  += new _dispSolutionEvents_BeforeClosingEventHandler(solutionEvents_BeforeClosing);
            solutionEvents.ProjectAdded   += new _dispSolutionEvents_ProjectAddedEventHandler(solutionEvents_ProjectAdded);
            solutionEvents.ProjectRemoved += new _dispSolutionEvents_ProjectRemovedEventHandler(solutionEvents_ProjectRemoved);

            // Create error provider
            errorListProvider = new ErrorListProvider(this);
            errorListProvider.ProviderGuid = GuidList.guidErrorProvider;
            errorListProvider.ProviderName = "Coco/R Error Provider"; //name doesn't matter, nobody else needs/uses it
        }