예제 #1
0
        protected override void Initialize()
        {
            base.Initialize();

            // Register the editor factory.
            RegisterEditorFactory(new CMakeEditorFactory(this));

            // Register the language service.
            IServiceContainer    container = this as IServiceContainer;
            CMakeLanguageService service   = new CMakeLanguageService();

            service.SetSite(this);
            container.AddService(typeof(CMakeLanguageService), service, true);

            // Register callbacks to respond to menu commands.
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService))
                                        as OleMenuCommandService;

            if (mcs != null)
            {
                RegisterMenuCallback(mcs, CMakeCmdIds.cmdidCMake, CMakeMenuCallback);
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelp,
                                         "html\\index.html", "cmake.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCommands,
                                         "html\\manual\\cmake-commands.7.html", "cmake-commands.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpModules,
                                         "html\\manual\\cmake-modules.7.html", "cmake-modules.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpProperties,
                                         "html\\manual\\cmake-properties.7.html", "cmake-properties.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpVariables,
                                         "html\\manual\\cmake-variables.7.html", "cmake-variables.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCPack,
                                         "html\\manual\\cpack.1.html", "cpack.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCTest,
                                         "html\\manual\\ctest.1.html", "ctest.html");
                RegisterMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpWebSite,
                                     CMakeHelpWebSiteMenuCallback);
            }

            // Register this object as an OLE component.  This is boilerplate code that
            // every language service package must have in order for the language
            // service's OnIdle method to be called.
            IOleComponentManager manager =
                (IOleComponentManager)GetService(typeof(SOleComponentManager));

            if (manager != null)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime |
                                   (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                     (uint)_OLECADVF.olecadvfRedrawOff |
                                     (uint)_OLECADVF.olecadvfWarningsOff;
                crinfo[0].uIdleTimeInterval = 100;
                uint componentID = 0;
                manager.FRegisterComponent(this, crinfo, out componentID);
            }
        }
예제 #2
0
        // The implementation of IOleComponent is boilerplate code that every language
        // service package must provide in order for the language service's OnIdle
        // method to be called.  The implementation FDoIdle manually calls OnIdle on the
        // language service.  The other methods are all stubbed out.
        #region IOleComponent Implementation
        public virtual int FDoIdle(uint grfidlef)
        {
            bool periodic = ((grfidlef & (uint)_OLEIDLEF.oleidlefPeriodic) != 0);
            CMakeLanguageService service =
                (CMakeLanguageService)GetService(typeof(CMakeLanguageService));

            if (service != null)
            {
                service.OnIdle(periodic);
            }
            return(0);
        }
예제 #3
0
        protected override void Initialize()
        {
            base.Initialize();

            // Register the editor factory.
            RegisterEditorFactory(new CMakeEditorFactory(this));

            // Register the language service.
            IServiceContainer container = this as IServiceContainer;
            CMakeLanguageService service = new CMakeLanguageService();
            service.SetSite(this);
            container.AddService(typeof(CMakeLanguageService), service, true);

            // Register callbacks to respond to menu commands.
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService))
                as OleMenuCommandService;
            if (mcs != null)
            {
                RegisterMenuCallback(mcs, CMakeCmdIds.cmdidCMake, CMakeMenuCallback);
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelp,
                    "html\\index.html", "cmake.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCommands,
                    "html\\manual\\cmake-commands.7.html", "cmake-commands.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpModules,
                    "html\\manual\\cmake-modules.7.html", "cmake-modules.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpProperties,
                    "html\\manual\\cmake-properties.7.html", "cmake-properties.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpVariables,
                    "html\\manual\\cmake-variables.7.html", "cmake-variables.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCPack,
                    "html\\manual\\cpack.1.html", "cpack.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCTest,
                    "html\\manual\\ctest.1.html", "ctest.html");
                RegisterMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpWebSite,
                    CMakeHelpWebSiteMenuCallback);
            }

            // Register this object as an OLE component.  This is boilerplate code that
            // every language service package must have in order for the language
            // service's OnIdle method to be called.
            IOleComponentManager manager =
                (IOleComponentManager)GetService(typeof(SOleComponentManager));
            if (manager != null)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime |
                    (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                    (uint)_OLECADVF.olecadvfRedrawOff |
                    (uint)_OLECADVF.olecadvfWarningsOff;
                crinfo[0].uIdleTimeInterval = 100;
                uint componentID = 0;
                manager.FRegisterComponent(this, crinfo, out componentID);
            }
        }