コード例 #1
0
 /// <summary>
 /// Force l'affichage de la task list
 /// </summary>
 public void ShowErrorList()
 {
     if (errorList != null)
     {
         errorList.BringToFront();
         errorList.ForceShowErrors();
     }
 }
コード例 #2
0
        public void ResumeRefresh(bool focusErrorList)
        {
            _errorProvider.ResumeRefresh();

            if (_errorsSinceSuspend > 0 && focusErrorList)
            {
                _errorProvider.Show();
                _errorProvider.BringToFront();
            }
        }
コード例 #3
0
 public override void ShowAndActivate()
 {
     try {
         _errorListProvider.Show();
         _errorListProvider.BringToFront();
     } catch (Exception ex) when(!ex.IsCriticalException())
     {
         Debug.Fail(ex.ToUnhandledExceptionMessage(GetType()));
     }
 }
コード例 #4
0
        public void ResumeRefresh()
        {
            _errorProvider.ResumeRefresh();

            if (_errorsSinceSuspend > 0)
            {
                _errorProvider.Show();
                _errorProvider.BringToFront();
            }
        }
コード例 #5
0
        public static void ShowError(ErrorListProvider errorListProvider, TaskErrorCategory errorCategory, TaskPriority priority, string errorText, IVsHierarchy hierarchyItem)
        {
            ErrorTask errorTask = new ErrorTask();

            errorTask.Text          = errorText;
            errorTask.ErrorCategory = errorCategory;
            errorTask.Category      = TaskCategory.BuildCompile;
            errorTask.Priority      = priority;
            errorTask.HierarchyItem = hierarchyItem;
            errorListProvider.Tasks.Add(errorTask);
            errorListProvider.BringToFront();
            errorListProvider.ForceShowErrors();
        }
コード例 #6
0
        void TraceMessage(string msg)
        {
            OutputWindowPanes panes = dte.ToolWindows.OutputWindow.OutputWindowPanes;
            OutputWindowPane  pane;
            String            cppScript = "C++ Script";

            try
            {
                pane = panes.Item(cppScript);
            }
            catch (ArgumentException)
            {
                pane = panes.Add(cppScript);
            }

            pane.OutputString(msg + "\n");
            pane.Activate();
            dte.ToolWindows.OutputWindow.Parent.Activate();
            return;

            //foreach (OutputWindowPane pane in panes)
            //{
            //    if (pane.Name.Contains("Build"))
            //    {
            //        pane.OutputString(msg + "\n");
            //        pane.Activate();
            //        //dte.ToolWindows.OutputWindow.Parent.Activate();
            //        return;
            //    }
            //}

            _errorListProvider.Tasks.Clear();
            var task = new ErrorTask
            {
                Document      = @"d:\PrototypingQuick\VSSyncProj\OpenSyncProjectFile.cs",
                Line          = 105,
                Column        = 17,
                ErrorCategory = TaskErrorCategory.Error,
                Category      = TaskCategory.BuildCompile,
                Text          = "Hello error panel"
            };

            task.Navigate += Task_Navigate;
            _errorListProvider.Tasks.Add(task);
            _errorListProvider.Show();
            _errorListProvider.BringToFront();
        }
コード例 #7
0
        public void End()
        {
            NuGetUIThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                OutputConsole.WriteLine(Resources.Finished);
                OutputConsole.WriteLine(string.Empty);

                if (ErrorListProvider.Tasks.Count > 0)
                {
                    ErrorListProvider.BringToFront();
                    ErrorListProvider.ForceShowErrors();
                }

                // Give the error list focus
                ErrorListTableDataSource.Value.BringToFront();
            });
        }
コード例 #8
0
        internal void WriteVisualStudioErrorList(MessageCategory category, string text, string path, int line, int column)
        {
            TaskPriority      priority      = category == MessageCategory.Error ? TaskPriority.High : TaskPriority.Normal;
            TaskErrorCategory errorCategory = category >= MessageCategory.Error ? TaskErrorCategory.Error : TaskErrorCategory.Warning;

            ErrorTask task = new ErrorTask();

            task.Document      = path;
            task.Line          = line - 1;      // The task list does +1 before showing this number.
            task.Column        = column - 1;    // The task list does +1 before showing this number.
            task.Text          = text;
            task.Priority      = priority;      // High or Normal
            task.ErrorCategory = errorCategory; // Error or Warning, no support for Message yet
            task.Category      = TaskCategory.BuildCompile;
            _errorListProvider.Tasks.Add(task);

            if (category == MessageCategory.Severe)
            {
                _errorListProvider.BringToFront();
            }
        }
コード例 #9
0
 public override void ShowAndActivate()
 {
     _errorListProvider.Show();
     _errorListProvider.BringToFront();
 }
コード例 #10
0
        internal static void ShowError(string message, string document, string helpSubPage = "", int lineNo = 0, int column = 0)
        {
            ErrorTask task = new ErrorTask()
            {
                Category      = TaskCategory.Misc,
                ErrorCategory = TaskErrorCategory.Error,
                Text          = message
            };

            DTE dte = (DTE)(_serviceProvider.GetService(typeof(DTE)));
            IServiceProvider serviceProvider = new ServiceProvider(dte as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);

            if (document != null)
            {
                task.Document = document;

                task.Navigate += (s, e) =>
                {
                    try
                    {
                        IVsUIHierarchy hierarchy;
                        uint           itemID;
                        IVsWindowFrame docFrame;
                        IVsTextView    textView;
                        VsShell.OpenDocument(serviceProvider, document, Guids.LOGVIEWID_Code, out hierarchy, out itemID, out docFrame, out textView);
                        ThrowOnFailure(docFrame.Show());
                        if (textView != null)
                        {
                            ThrowOnFailure(textView.SetCaretPos(lineNo, column));
                        }
                    }catch (Exception)
                    {
                        // don't trow crazy exceptions when trying to navigate to errors
                    }
                };
            }

            task.Help += (s, e) =>
            {
                var mainPage = "http://fsprojects.github.io/Paket/";
                var errorUrl = mainPage;
                if (!String.IsNullOrWhiteSpace(helpSubPage))
                {
                    errorUrl += helpSubPage;
                }

                IVsWebBrowsingService webBrowsingService = serviceProvider.GetService(typeof(SVsWebBrowsingService)) as IVsWebBrowsingService;
                if (webBrowsingService != null)
                {
                    IVsWindowFrame windowFrame;
                    webBrowsingService.Navigate(errorUrl, 0, out windowFrame);
                    return;
                }

                IVsUIShellOpenDocument openDocument = serviceProvider.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
                if (openDocument != null)
                {
                    openDocument.OpenStandardPreviewer(0, errorUrl, VSPREVIEWRESOLUTION.PR_Default, 0);
                    return;
                }
            };
            _paketErrorProvider.Tasks.Add(task);
            _paketErrorProvider.Show();
            _paketErrorProvider.BringToFront();
        }
コード例 #11
0
        public static void Publish(EnvDTE.Project project, Dictionary <string, string> buildProperties, Microsoft.Build.Framework.LoggerVerbosity verbosity)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (buildProperties == null)
            {
                throw new ArgumentNullException("buildProperties");
            }

            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                DTE dte    = (DTE)CloudFoundryVisualStudioPackage.GetGlobalService(typeof(DTE));
                var window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
                var output = (OutputWindow)window.Object;

                OutputWindowPane pane = null;

                pane = output.OutputWindowPanes.Cast <OutputWindowPane>().FirstOrDefault(x => x.Name == "Publish");

                if (pane == null)
                {
                    pane = output.OutputWindowPanes.Add("Publish");
                }

                var showOutputWindowPropertyValue = VsUtils.GetVisualStudioSetting("Environment", "ProjectsAndSolution", "ShowOutputWindowBeforeBuild");

                if (showOutputWindowPropertyValue != null)
                {
                    if ((bool)showOutputWindowPropertyValue == true)
                    {
                        window.Visible = true;
                    }
                }

                pane.Activate();

                ErrorListProvider errorList = CloudFoundryVisualStudioPackage.GetErrorListPane;

                if (errorList == null)
                {
                    throw new InvalidOperationException("Could not retrieve error list provider");
                }

                errorList.Tasks.Clear();

                MSBuildLogger customLogger = new MSBuildLogger(pane, errorList);

                customLogger.Verbosity = verbosity;
                pane.Clear();

                pane.OutputString("Starting push...");

                Microsoft.Build.Evaluation.Project websiteProject = null;

                using (var buildManager = new BuildManager())
                {
                    using (var projectCollection = new ProjectCollection())
                    {
                        string proj = project.FullName;

                        if (project.Object is VsWebSite.VSWebSite)
                        {
                            string projectDir = new System.IO.DirectoryInfo(System.IO.Path.GetDirectoryName(buildProperties["PublishProfile"])).Parent.Parent.FullName;
                            proj = Path.Combine(projectDir, CloudFoundry.VisualStudio.ProjectPush.PushEnvironment.DefaultWebsiteProjectName);
                        }

                        websiteProject = projectCollection.LoadProject(proj);

                        foreach (KeyValuePair <string, string> parameter in buildProperties)
                        {
                            websiteProject.SetProperty(parameter.Key, parameter.Value);
                        }

                        BuildParameters buildParameters = new BuildParameters(projectCollection);
                        buildParameters.Loggers         = new List <ILogger>()
                        {
                            customLogger
                        };
                        BuildRequestData buildRequestData = new BuildRequestData(websiteProject.CreateProjectInstance(), new string[] { });

                        buildManager.Build(buildParameters, buildRequestData);
                        if (errorList.Tasks.Count > 0)
                        {
                            errorList.BringToFront();
                        }

                        pane.OutputString("Push operation finished!");
                        projectCollection.UnregisterAllLoggers();
                    }
                }
            });
        }
コード例 #12
0
 /// <summary>
 /// Focus the visual studio error list
 /// </summary>
 public static void ShowErrorList()
 {
     ErrorListProvider.BringToFront();
 }