コード例 #1
0
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView view)
        {
            var buffer = view.TextBuffer;

            IOleCommandTarget shellCommandDispatcher = GetShellCommandDispatcher(view);

            if (shellCommandDispatcher == null)
            {
                return(null);
            }

            ITelemetrySession   telemetrySession = TelemetrySessionForPPT.Create(typeof(GoToDefMouseHandler).Assembly);
            IVsExtensionManager manager          = _globalServiceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;

            if (manager == null)
            {
                return(null);
            }

            IInstalledExtension extension;

            manager.TryGetInstalledExtension("GoToDef", out extension);
            if (extension != null)
            {
                return(null);
            }

            return(new GoToDefMouseHandler(view,
                                           shellCommandDispatcher,
                                           telemetrySession,
                                           _aggregatorFactory.GetClassifier(buffer),
                                           _navigatorService.GetTextStructureNavigator(buffer),
                                           CtrlKeyState.GetStateForView(view)));
        }
コード例 #2
0
ファイル: InformationBar.cs プロジェクト: smodin/VS-PPT
        public InformationBarMargin(IWpfTextView textView, ITextDocument document, IEditorOperations editorOperations, ITextUndoHistory undoHistory)
        {
            _textView    = textView;
            _document    = document;
            _operations  = editorOperations;
            _undoHistory = undoHistory;

            _telemetrySession = TelemetrySessionForPPT.Create(this.GetType().Assembly);

            var informationBar = new InformationBarControl();

            informationBar.Tabify.Click        += Tabify;
            informationBar.Untabify.Click      += Untabify;
            informationBar.Hide.Click          += Hide;
            informationBar.DontShowAgain.Click += DontShowAgain;

            this.Height  = 0;
            this.Content = informationBar;
            this.Name    = MarginName;

            document.FileActionOccurred += FileActionOccurred;

            // Delay the initial check until the view gets focus.
            textView.GotAggregateFocus += GotAggregateFocus;
        }
コード例 #3
0
        private static void LogTipClosed(object sender, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement context = sender as FrameworkElement;

            if ((context != null) && !context.IsVisible)
            {
                context.IsVisibleChanged -= LogTipClosed;

                DateTime now = DateTime.UtcNow;
                StructureMarginElement.s_elapsedTime    += (now - StructureMarginElement.s_lastTimeChanged);
                StructureMarginElement.s_lastTimeChanged = now;

                if ((!StructureMarginElement.s_logged) && (StructureMarginElement.s_elapsedTime > StructureMarginElement.s_tipReportingDelay))
                {
                    if (StructureMarginElement.s_telemetrySession == null)
                    {
                        StructureMarginElement.s_telemetrySession = TelemetrySessionForPPT.Create(typeof(StructureMarginElement).Assembly);
                    }

                    StructureMarginElement.s_telemetrySession.PostEvent(StructureMarginElement.s_lastKey);

                    StructureMarginElement.s_elapsedTime = TimeSpan.Zero;
                    StructureMarginElement.s_logged      = true;
                }
            }
        }
コード例 #4
0
ファイル: CommandFilterFactory.cs プロジェクト: zyonet/VS-PPT
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView      textView         = editorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
            ITextUndoHistory  undoHistory      = undoHistoryRegistry.RegisterHistory(textView.TextBuffer);
            IEditorOperations editorOperations = editorOperationsFactoryService.GetEditorOperations(textView);
            IEditorOptions    editorOptions    = editorOptionsFactoryService.GetOptions(textView);
            IViewPrimitives   viewPrimitives   = editorPrimitivesFactoryService.GetViewPrimitives(textView);

            if (_telemetrySession == null)
            {
                _telemetrySession = TelemetrySessionForPPT.Create(this.GetType().Assembly);
            }

            // Object will survive since it adds itself to the view's command filter chain
            new CommandFilter(
                textViewAdapter,
                textView,
                htmlBuilderService,
                rtfBuilderService,
                editorOperations,
                undoHistory,
                editorOptions,
                viewPrimitives,
                _telemetrySession);
        }
コード例 #5
0
        public IMouseProcessor GetAssociatedProcessor(IWpfTextView textView)
        {
            if (_telemetrySession == null)
            {
                _telemetrySession = TelemetrySessionForPPT.Create(this.GetType().Assembly);
            }

            return(MiddleClickScroll.Create(textView, _telemetrySession));
        }
コード例 #6
0
ファイル: Package.cs プロジェクト: zyonet/VS-PPT
 public ToolsOptionsPage()
 {
     _telemetrySession       = TelemetrySessionForPPT.Create(this.GetType().Assembly);
     BeforeCodeSnippet       = _beforeCodeSnippetDefault;
     AfterCodeSnippet        = _afterCodeSnippetDefault;
     Space                   = _spaceDefault;
     ReplaceLineBreaksWithBR = _replaceLineBreaksWithBRDefault;
     ReplaceTabsWithSpaces   = _replaceTabsWithSpacesDefault;
     UnindentToRemoveExtraLeadingWhitespace = _unindentToRemoveExtraLeadingWhitespaceDefault;
     EmitSpanClass = _emitSpanClassDefault;
     EmitSpanStyle = _emitSpanStyleDefault;
     Instance      = this;
 }
コード例 #7
0
ファイル: OptionsPagePackage.cs プロジェクト: lethe555/VS-PPT
        protected override void Initialize()
        {
            base.Initialize();

            // Log telemetry on the initial settings values
            OptionsPagePackage.TelemetrySession = TelemetrySessionForPPT.Create(this.GetType().Assembly);

            IEditorOptions globalOptions = (Common.GetMefService <IEditorOptionsFactoryService>()).GlobalOptions;

            foreach (object option in OptionsPage.Options)
            {
                var definition = option as LabeledOptionDefinition;
                if (definition != null)
                {
                    if (globalOptions.IsOptionDefined(definition.Name, localScopeOnly: true))
                    {
                        var value = globalOptions.GetOptionValue <bool>(definition.Name);
                        OptionsPagePackage.TelemetrySession.PostEvent("VS/PPT-Options/OptionInitialValue", definition.Name, value);
                    }
                }
            }
        }
コード例 #8
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = _editorFactory.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }

            if (_telemetrySession == null)
            {
                _telemetrySession = TelemetrySessionForPPT.Create(this.GetType().Assembly);
            }

            IOleCommandTarget next;
            var commandFilter = new CommandFilter(textView, _peekBroker, _telemetrySession);
            int hr            = textViewAdapter.AddCommandFilter(commandFilter, out next);

            if (next != null)
            {
                commandFilter.Next = next;
            }
        }