예제 #1
0
#pragma warning restore 649

        /// <summary>
        /// Called when a text view having matching roles is created over a text data model having a matching content type.
        /// Instantiates a <see cref="EmbedFigureManager"/> when the textView is created, if it wasn't already instantiated.
        /// </summary>
        /// <remarks>This function is called by the framework on Main Thread</remarks>
        /// <param name="text_view">The view upon which the adornment should be placed</param>
        public void TextViewCreated(MVSTE.IWpfTextView text_view)
        {
            if (null == text_view || null == text_view.TextBuffer)
            {
                return;
            }

            // The adornment will listen to any event that changes the layout (text changes, scrolling, etc)
            text_view.Properties.GetOrCreateSingletonProperty(() => new EmbedFigureManager(text_view, m_TextDocumentFactoryService));
        }
예제 #2
0
#pragma warning restore 649

        /// <summary>
        /// Called when a text view having matching roles is created over a text data model having a matching content type.
        /// Instantiates a <see cref="EmbedFigureManager"/> when the <see cref="MVSTF.ILineTransformSource"/> is created, if it wasn't already instantiated.
        /// </summary>
        /// <remarks>This function is called by the framework on Main Thread</remarks>
        /// <param name="text_view">The view upon which the adornment should be placed</param>
        public MVSTF.ILineTransformSource Create(MVSTE.IWpfTextView text_view)
        {
            if (null == text_view || null == text_view.TextBuffer)
            {
                return(null);
            }

            EmbedFigureManager manager = text_view.Properties.GetOrCreateSingletonProperty(() => new EmbedFigureManager(text_view, m_TextDocumentFactoryService));

            return(new EmbedFigureLineTransformSource(manager));
        }
예제 #3
0
        /// <summary>
        /// Returns an IVsTextView for the given file path, if the given file is open in Visual Studio.
        /// </summary>
        /// <param name="filePath">Full Path of the file you are looking for.</param>
        /// <returns>The IVsTextView for this file, if it is open, null otherwise.</returns>
        internal static Microsoft.VisualStudio.TextManager.Interop.IVsTextView GetIVsTextView(DTE dte, string filePath)
        {
            Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)dte;
            Microsoft.VisualStudio.Shell.ServiceProvider        serviceProvider = new Microsoft.VisualStudio.Shell.ServiceProvider(sp);

            Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy uiHierarchy;
            uint itemID;

            Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame windowFrame;
            Microsoft.VisualStudio.Text.Editor.IWpfTextView     wpfTextView = null;
            if (Microsoft.VisualStudio.Shell.VsShellUtilities.IsDocumentOpen(serviceProvider, filePath, Guid.Empty, out uiHierarchy, out itemID, out windowFrame))
            {
                // Get the IVsTextView from the windowFrame.
                return(Microsoft.VisualStudio.Shell.VsShellUtilities.GetTextView(windowFrame));
            }

            return(null);
        }
예제 #4
0
        private void RefreshFunctionList(VsTextEditor.IWpfTextView view)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (!c_functionTab.IsSelected)
            {
                return;
            }

            if (view != null)
            {
                var fileStore = CodeModel.FileStore.GetOrCreateForTextBuffer(view.TextBuffer);
                if (fileStore != null)
                {
                    var snapshot = view.TextSnapshot;
                    if (_activeView != view || _activeSnapshot != snapshot)
                    {
                        _activeView     = view;
                        _activeSnapshot = snapshot;

                        var appSettings = ProbeEnvironment.CurrentAppSettings;
                        var fileName    = VsTextUtil.TryGetDocumentFileName(view.TextBuffer);
                        _activeFunctions = (from f in fileStore.GetFunctionDropDownList(appSettings, fileName, snapshot)
                                            orderby f.Name.ToLower()
                                            select new FunctionListItem(f)).ToArray();
                        ApplyFunctionFilter();
                        c_functionList.ItemsSource = _activeFunctions;
                    }
                    return;
                }
            }

            _activeView                = null;
            _activeSnapshot            = null;
            _activeFunctions           = null;
            c_functionList.ItemsSource = null;
        }
예제 #5
0
 public ILineTransformSource Create(Microsoft.VisualStudio.Text.Editor.IWpfTextView textView)
 {
     return(new BraceLineTransformSource());
 }
예제 #6
0
        public void OnDocumentActivated(VsTextEditor.IWpfTextView view)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            RefreshFunctionList(view);
        }