Beispiel #1
0
        public void Show(TreeModelBrowserDescriptor browserDescriptor)
        {
            ToolWindowInstance instance = _toolWindowClass.RegisterInstance(
                _lifetime,
                StringUtil.MakeTitle(browserDescriptor.Title.Value), browserDescriptor.Image,
                (lt, twi) => new TreeModelBrowserPanelPsiWPF(browserDescriptor, lt, _actionBarManager, _environment, _windowsHookManager));

            instance.Lifetime.AddAction(() => browserDescriptor.LifetimeDefinition.Terminate());
            instance.EnsureControlCreated().Show();
        }
        public void Show(TreeModelBrowserDescriptor browserDescriptor)
        {
            ToolWindowInstance instance = myToolWindowClass.RegisterInstance(
                myLifetime,
                StringUtil.MakeTitle(browserDescriptor.Title.Value), browserDescriptor.Image,
                (lt, twi) => TreeModelBrowserPanelPsiWPF.SelectTreeImplementation(browserDescriptor, lt, myActionBarManager, myLocks, mySettingsStore, myColorThemeManager, myThemedIconManager));

            instance.Lifetime.AddAction(() => browserDescriptor.LifetimeDefinition.Terminate());
            instance.EnsureControlCreated().Show();
        }
Beispiel #3
0
        public void Show()
        {
            ToolWindowInstance instance = toolWindowClass.RegisterInstance(
                lifetime,
                StringUtil.MakeTitle("YouTrack Explorer"), // title of your window; tip: StringUtil.MakeTitle
                null,                                      // return a System.Drawing.Image to be displayed
                (lt, twi) =>
            {
                var label = new RichTextLabel(application)
                {
                    BackColor = SystemColors.Control, Dock = DockStyle.Fill
                };
                label.RichTextBlock.Add(new RichText("My Content", new TextStyle(FontStyle.Bold)));
                label.RichTextBlock.Parameters = new RichTextBlockParameters(8, ContentAlignment.MiddleCenter);
                return(label.BindToLifetime(lt));
            });

            instance.EnsureControlCreated().Show();
        }
Beispiel #4
0
        public TutorialWindow(string contentPath, Lifetime tutorialLifetime, TutorialWindowManager windowManager,
                              ISolution solution, IPsiFiles psiFiles,
                              ChangeManager changeManager, TextControlManager textControlManager, IShellLocks shellLocks,
                              IEditorManager editorManager,
                              DocumentManager documentManager, IUIApplication environment, IActionManager actionManager,
                              TabbedToolWindowClass toolWindowClass,
                              WindowsHookManager windowsHookManager,
                              IColorThemeManager colorThemeManager)
        {
            _windowManager     = windowManager;
            _htmlGenerator     = new HtmlGenerator(tutorialLifetime, colorThemeManager);
            _tutorialLifetime  = tutorialLifetime;
            _shellLocks        = shellLocks;
            _colorThemeManager = colorThemeManager;

            if (!solution.GetComponent <ISolutionOwner>().IsRealSolutionOwner)
            {
                return;
            }

            _toolWindowInstance = toolWindowClass.RegisterInstance(
                tutorialLifetime, null, null,
                (lt, twi) =>
            {
                twi.QueryClose.Value = true;

                var containerControl = new TutorialPanel(environment).BindToLifetime(lt);

                var viewControl = new HtmlViewControl(windowsHookManager, actionManager)
                {
                    Dock = DockStyle.Fill,
                    WebBrowserShortcutsEnabled = false
                }.BindToLifetime(lt);

                var webControlHandler = new WebBrowserHostUiHandler(viewControl)
                {
                    Flags = HostUIFlags.DPI_AWARE,
                    IsWebBrowserContextMenuEnabled = false
                };

                lt.AddBracket(
                    () => _containerControl = containerControl,
                    () => _containerControl = null);

                lt.AddAction(() => _progressBar = null);

                lt.AddBracket(
                    () => _viewControl = viewControl,
                    () => _viewControl = null);

                lt.AddBracket(
                    () =>
                {
                    _containerControl.Controls.Add(_viewControl);
                    _containerControl.Controls.Add(_progressBar);
                },
                    () =>
                {
                    _containerControl.Controls.Remove(_viewControl);
                    _containerControl.Controls.Remove(_progressBar);
                });

                _colorThemeManager.ColorThemeChanged.Advise(tutorialLifetime, RefreshKeepContent);

                SetColors();

                _htmlMediator = new HtmlMediator(tutorialLifetime, this);
                _htmlMediator.OnNextStepButtonClick.Advise(tutorialLifetime,
                                                           () => NextStep?.Invoke(null, EventArgs.Empty));
                _htmlMediator.OnRunStepNavigationLinkClick.Advise(tutorialLifetime, NavigateToCodeByLink);

                var focusTracker = new WindowFocusTracker(tutorialLifetime);
                focusTracker.IsFocusOnEditor.Change.Advise(tutorialLifetime,
                                                           () => _htmlMediator.ChangeNextStepButtonText(focusTracker.IsFocusOnEditor.Value));

                _htmlMediator.OnPageHasFullyLoaded.Advise(tutorialLifetime,
                                                          () => { _htmlMediator.ChangeNextStepButtonText(focusTracker.IsFocusOnEditor.Value); });

                return(new EitherControl(lt, containerControl));
            });

            _stepPresenter = new TutorialStepPresenter(this, contentPath, tutorialLifetime, solution, psiFiles,
                                                       changeManager,
                                                       textControlManager, shellLocks, editorManager, documentManager, environment, actionManager);

            _toolWindowInstance.Title.Value = _stepPresenter.Title;
        }
Beispiel #5
0
        public SampleToolWindow(Lifetime lifetime, ToolWindowManager toolWindowManager,
                                SampleToolWindowDescriptor sampleToolWindowDescriptor, ISettingsStore settingsStore,
                                IColorThemeManager colorThemeManager)
        {
            _toolWindowClass = toolWindowManager.Classes[sampleToolWindowDescriptor] as TabbedToolWindowClass;
            if (_toolWindowClass == null)
            {
                throw new ApplicationException("ToolWindowClass");
            }

            _toolWindowInstance = _toolWindowClass.RegisterInstance(lifetime, "Sample Tool Window", null,
                                                                    (lt, twi) =>
            {
                twi.QueryClose.Value = true;

                var toolPanel = new ToolPanel();

                // Tool Window
                var toolwndView    = new ToolWindowView();
                var toolwndViewTab = new TabItem
                {
                    Content = toolwndView,
                    Header  = toolwndView.Name
                };
                toolPanel.tabControl.Items.Add(toolwndViewTab);

                // Options
                var optionsPageViewModel = new OptionsPageViewModel(lt, settingsStore);
                var optionsPageView      = new OptionsPageView {
                    DataContext = optionsPageViewModel
                };
                var optionsPageViewTab = new TabItem
                {
                    Content = optionsPageView,
                    Header  = optionsPageView.Name
                };
                toolPanel.tabControl.Items.Add(optionsPageViewTab);

                // Actions
                var actionsViewModel = new ActionsViewModel(lt);
                var actionsView      = new ActionsView {
                    DataContext = actionsViewModel
                };
                var actionsViewTab = new TabItem
                {
                    Content = actionsView,
                    Header  = actionsView.Name
                };
                toolPanel.tabControl.Items.Add(actionsViewTab);

                // PSI Navigation
                var psiNavigationViewModel = new PsiNavigationViewModel(lt);
                var psiNavigationView      = new PsiNavigationView {
                    DataContext = psiNavigationViewModel
                };
                var psiNavigationViewTab = new TabItem
                {
                    Content = psiNavigationView,
                    Header  = psiNavigationView.Name
                };
                toolPanel.tabControl.Items.Add(psiNavigationViewTab);

                // Context Action
                var contextActionView    = new ToLowerCaseContextActionView();
                var contextActionViewTab = new TabItem
                {
                    Content = contextActionView,
                    Header  = contextActionView.Name
                };
                toolPanel.tabControl.Items.Add(contextActionViewTab);

                // Quick Fix
                var quickFixView    = new CorrectBadWordQuickFixView();
                var quickFixViewTab = new TabItem
                {
                    Content = quickFixView,
                    Header  = quickFixView.Name
                };
                toolPanel.tabControl.Items.Add(quickFixViewTab);

                // Element Problem Analyzer and Code Highlighting
                var problemAnalyzerView    = new BadWordNamingView();
                var problemAnalyzerViewTab = new TabItem
                {
                    Content = problemAnalyzerView,
                    Header  = problemAnalyzerView.Name
                };
                toolPanel.tabControl.Items.Add(problemAnalyzerViewTab);

                // Solution Component
                var solcompView    = new SolutionComponentView();
                var solcompViewTab = new TabItem
                {
                    Content = solcompView,
                    Header  = solcompView.Name
                };
                toolPanel.tabControl.Items.Add(solcompViewTab);

                // Signals
                var sigViewModel = new SignalsViewModel(lt);
                var sigView      = new SignalsView {
                    DataContext = sigViewModel
                };
                var sigViewTab = new TabItem
                {
                    Content = sigView,
                    Header  = sigView.Name
                };
                toolPanel.tabControl.Items.Add(sigViewTab);

                // IProperty
                var propViewModel = new PropertyViewModel(lt);
                var propView      = new PropertyView {
                    DataContext = propViewModel
                };
                var propViewTab = new TabItem
                {
                    Content = propView,
                    Header  = propView.Name
                };
                toolPanel.tabControl.Items.Add(propViewTab);

                // UI Themes
                var uithemeViewModel = new UiThemeViewModel(lt, colorThemeManager);
                var uithemeView      = new UiThemeView {
                    DataContext = uithemeViewModel
                };
                var uithemeViewTab = new TabItem
                {
                    Content = uithemeView,
                    Header  = uithemeView.Name
                };
                toolPanel.tabControl.Items.Add(uithemeViewTab);

                return(new EitherControl(lt, toolPanel));
            });
        }