/// <summary>
 /// Initializes a new instance of <seealso cref="ErrorFrameTooltipViewModel"/> class.
 /// </summary>
 /// <param name="errorItem">The error item the tooltip shows.</param>
 public ErrorFrameTooltipViewModel(ErrorGroupItem errorItem)
 {
     OnCloseButtonCommand          = new ProtectedCommand(ShowTooltipUtils.HideTooltip);
     OnBackToErrorReportingCommand = new ProtectedCommand(
         () => ToolWindowCommandUtils.ShowToolWindow <ErrorReportingDetailToolWindow>());
     Error = errorItem;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorReportingToolWindowCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private ErrorReportingToolWindowCommand(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            _package = package;

            IMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(
                    (sender, e) =>
                {
                    ToolWindowCommandUtils.ShowToolWindow <ErrorReportingToolWindow>();
                    EventsReporterWrapper.ReportEvent(ErrorsViewerOpenEvent.Create());
                },
                    menuCommandID);
                menuItem.BeforeQueryStatus += ToolWindowCommandUtils.EnableMenuItemOnValidProjectId;
                commandService.AddCommand(menuItem);
            }
        }
Пример #3
0
        private void NavigateToDetailWindow(ErrorGroupItem groupItem)
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <ErrorReportingDetailToolWindow>();

            window.ViewModel.UpdateView(groupItem, _selectedTimeRange);

            EventsReporterWrapper.ReportEvent(ErrorsViewerNavigateToDetailWindowEvent.Create());
        }
Пример #4
0
        public void TestShowToolWindowNoPackage()
        {
            GoogleCloudExtensionPackage.Instance = null;

            var result = ToolWindowCommandUtils.ShowToolWindow <ToolWindowPane>();

            Assert.IsNull(result);
        }
Пример #5
0
        public void TestShowToolWindowNoWindowFrame()
        {
            PackageMock.Setup(p => p.FindToolWindow <ToolWindowPane>(true, 0))
            .Returns(() => new ToolWindowPane {
                Frame = null
            });

            ToolWindowCommandUtils.ShowToolWindow <ToolWindowPane>();
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of <seealso cref="ErrorReportingDetailViewModel"/> class.
 /// </summary>
 public ErrorReportingDetailViewModel()
 {
     OnGotoSourceCommand = new ProtectedCommand <StackFrame>(
         (frame) => ShowTooltipUtils.ErrorFrameToSourceLine(GroupItem, frame));
     OnBackToOverViewCommand         = new ProtectedCommand(() => ToolWindowCommandUtils.ShowToolWindow <ErrorReportingToolWindow>());
     OnAutoReloadCommand             = new ProtectedCommand(() => ErrorHandlerUtils.HandleAsyncExceptions(UpdateGroupAndEventAsync));
     _datasource                     = new Lazy <StackdriverErrorReportingDataSource>(CreateDataSource);
     CredentialsStore.Default.Reset += (sender, e) => OnCurrentProjectChanged();
     CredentialsStore.Default.CurrentProjectIdChanged += (sender, e) => OnCurrentProjectChanged();
 }
Пример #7
0
        public void TestShowToolWindowShowError()
        {
            var mockedFrame = Mock.Of <IVsWindowFrame>(f => f.Show() == VSConstants.E_UNEXPECTED);

            PackageMock.Setup(p => p.FindToolWindow <ToolWindowPane>(true, 0))
            .Returns(() => new ToolWindowPane {
                Frame = mockedFrame
            });

            ToolWindowCommandUtils.ShowToolWindow <ToolWindowPane>();
        }
Пример #8
0
        public void TestShowToolWindowSuccess()
        {
            var mockedFrame    = Mock.Of <IVsWindowFrame>(f => f.Show() == VSConstants.S_OK);
            var expectedResult = new ToolWindowPane {
                Frame = mockedFrame
            };

            PackageMock.Setup(p => p.FindToolWindow <ToolWindowPane>(true, 0)).Returns(() => expectedResult);

            var actualResult = ToolWindowCommandUtils.ShowToolWindow <ToolWindowPane>();

            Assert.AreEqual(expectedResult, actualResult);
        }
Пример #9
0
        public void TestShowToolWindowSpecificSuccess()
        {
            var expectedResult = new ToolWindowPane {
                Frame = _defaultFrame
            };
            const int toolWindowId = 2;

            PackageMock.Setup(p => p.FindToolWindow <ToolWindowPane>(true, toolWindowId))
            .Returns(() => expectedResult);

            var actualResult = ToolWindowCommandUtils.ShowToolWindow <ToolWindowPane>(toolWindowId);

            Assert.AreEqual(expectedResult, actualResult);
        }
        private void BackToLogsViewer()
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <LogsViewerToolWindow>(Log.ParentToolWindowId);

            if (Log.Entry == null || window == null)
            {
                Debug.WriteLine("Entry or window is null, this is likely a code bug");
                return;
            }
            if (FilterLogsOfSourceLine)
            {
                window.FilterOnSourceLocation(Log);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LogsViewerToolWindowCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private LogsViewerToolWindowCommand(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            _package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new OleMenuCommand(
                    (sender, e) => ToolWindowCommandUtils.ShowToolWindow <LogsViewerToolWindow>(), menuCommandID);
                menuItem.BeforeQueryStatus += ToolWindowCommandUtils.EnableMenuItemOnValidProjectId;
                commandService.AddCommand(menuItem);
            }
        }
Пример #12
0
        private void OnBrowseStackdriverLogCommand()
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <LogsViewerToolWindow>();

            window?.FilterGAEServiceLog(_service.Id, _version.Id);
        }
        private void OnBrowseStackdriverLogCommand()
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <LogsViewerToolWindow>();

            window?.FilterVMInstanceLog(Instance.Id.Value.ToString());
        }
Пример #14
0
        private void NavigateToDetailWindow(ErrorGroupItem groupItem)
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <ErrorReportingDetailToolWindow>();

            window.ViewModel.UpdateView(groupItem, _selectedTimeRange);
        }