Beispiel #1
0
 private static void CheckError(int hr, String operation)
 {
     if (hr != Constants.S_OK)
     {
         PkgSource.LogInfo("{0} returned 0x{1:x8}", operation, hr);
         throw new InvalidOperationException(String.Format("{0} returned 0x{1:x8}", operation, hr));
     }
 }
Beispiel #2
0
        public static ITextBuffer GetPrimaryBuffer(ITextView view)
        {
            var buffers = view.BufferGraph.GetTextBuffers(
                (x) => !x.ContentType.IsOfType("projection")
                );

            if (buffers.Count <= 0)
            {
                PkgSource.LogInfo("Could not find a primary buffer on view: {0}", view);
                return(view.BufferGraph.TopBuffer);
            }
            return(buffers[0]);
        }
Beispiel #3
0
        protected override void Initialize()
        {
            base.Initialize();
            PkgSource.Initialize(this);
            PkgSource.VsVersion = FindVSVersion();
            InitializeTelemetry();
            InitializeActivityLog();

            if (GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
            {
                InitializeViewMenuCommands(mcs);
                InitializeTextEditorCommands(mcs);
            }

            this.AddOptionKey(USER_OPTIONS_KEY);
        }
Beispiel #4
0
        protected override void Initialize()
        {
            base.Initialize();
            LogInfo("Initializing VsfPackage");
            PkgSource.Initialize(this);
            PkgSource.VsVersion = FindVSVersion();
            InitializeTelemetry();
            InitializeActivityLog();

            this.FontChanger = new PresentationModeFontChanger(this);

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                InitializeViewMenuCommands(mcs);
                InitializeTextEditorCommands(mcs);
            }

            this.AddOptionKey(USER_OPTIONS_KEY);
        }