Example #1
0
        /// <summary>
        /// Invokes the editor for the specified Gallio test.
        /// </summary>
        /// <param name="uiBlob">Identifies the Project/Item blob to be displayed.</param>
        /// <param name="test">The test that the editor is being invoked for.</param>
        public void InvokeEditor(UIBlob uiBlob, ITestElement test)
        {
            if (!TipShellExtension.IsInitialized)
            {
                return;
            }

            GallioTestElement gallioTest = test as GallioTestElement;

            if (gallioTest != null)
            {
                if (gallioTest.Path == null)
                {
                    ErrorDialog.Show(NativeWindow.FromHandle((IntPtr)dte.MainWindow.HWnd),
                                     Properties.Resources.UnknownTestCodeLocationCaption,
                                     Properties.Resources.UnknownTestCodeLocation,
                                     "");
                }
                else
                {
                    Window window = dte.OpenFile(EnvDTE.Constants.vsViewKindCode, gallioTest.Path);

                    TextSelection selection = window.Selection as TextSelection;
                    if (gallioTest.Line != 0)
                    {
                        if (selection != null)
                        {
                            selection.MoveToLineAndOffset(gallioTest.Line, Math.Max(1, gallioTest.Column), false);
                        }
                    }

                    window.Activate();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Invokes the editor for the specified Gallio test.
        /// </summary>
        /// <param name="uiBlob">Identifies the Project/Item blob to be displayed.</param>
        /// <param name="test">The test that the editor is being invoked for.</param>
        public void InvokeEditor(UIBlob uiBlob, ITestElement test)
        {
            if (!TipShellExtension.IsInitialized)
                return;

            GallioTestElement gallioTest = test as GallioTestElement;

            if (gallioTest != null)
            {
                if (gallioTest.Path == null)
                {
                    ErrorDialog.Show(NativeWindow.FromHandle((IntPtr) dte.MainWindow.HWnd),
                        Properties.Resources.UnknownTestCodeLocationCaption, 
                        Properties.Resources.UnknownTestCodeLocation,
                        "");
                }
                else
                {
                    Window window = dte.OpenFile(EnvDTE.Constants.vsViewKindCode, gallioTest.Path);

                    TextSelection selection = window.Selection as TextSelection;
                    if (gallioTest.Line != 0)
                    {
                        if (selection != null)
                            selection.MoveToLineAndOffset(gallioTest.Line, Math.Max(1, gallioTest.Column), false);
                    }

                    window.Activate();
                }
            }
        }