Example #1
0
        /// <summary>
        /// Tells the wizard to initialize itself.
        /// </summary>
        public void Initialize()
        {
            iDialog = UIFactory.NewViewPart <ITitledAreaDialog>();
            if (iDialog == null) // TODO Use throwHelper
            {
                return;
            }

            iDialog.AddButton("Cancel", Cancel);
            iBtnFinish = iDialog.AddButton("Finish", Finish);
            iBtnNext   = iDialog.AddButton("Next >", NavigateNext);
            iBtnPrev   = iDialog.AddButton("< Back", NavigateBack);

            iBtnPrev.IsEnabled   = false;
            iBtnFinish.IsEnabled = false;
            iBtnNext.IsEnabled   = false;

            OnInitialize();

            if (PageCount == 0)
            {
                return;
            }

            iCurrentWizardPageIndex = 0;
            AssignCurrentWizardPageContent();
        }
Example #2
0
        /// <inheritdoc />
        public virtual void Initialize()
        {
            _dialog = UIFactory.NewShell <ITitledAreaDialog>();
            if (_dialog == null)
            {
                return;                  // TODO Use throwHelper
            }
            _dialog.AddButton(Messages.AbstractWizard_Button_Cancel, new ActionHandlerDelegate(Cancel));
            _btnFinish = _dialog.AddButton(Messages.AbstractWizard_Button_Finish, new ActionHandlerDelegate(Finish));
            _btnNext   = _dialog.AddButton(Messages.AbstractWizard_Button_Next, new ActionHandlerDelegate(NavigateNext));
            _btnPrev   = _dialog.AddButton(Messages.AbstractWizard_Button_Back, new ActionHandlerDelegate(NavigateBack));

            _btnPrev.Enabled   = false;
            _btnFinish.Enabled = false;
            _btnNext.Enabled   = false;

            OnInitialize();

            if (PageCount == 0)
            {
                return;
            }

            _currentWizardPageIndex = 0;
            AssignCurrentWizardPageContent();
        }
        /// <inheritdoc />
        public override void Run()
        {
            ITitledAreaDialog dialogWindow = UIFactory.NewShell <ITitledAreaDialog>();

            dialogWindow.Title       = Messages.WindowMenuShowViewsMenuHandler_DialogTitle;
            dialogWindow.Description = Messages.WindowMenuShowViewsMenuHandler_DialogDescription;
            dialogWindow.Width       = 460;

            IGridPanel gridComposite = UIFactory.NewWidget <IGridPanel>(dialogWindow);

            gridComposite.GridColumns = 1;
            gridComposite.GridRows    = 1;
            IListViewer listViewer = UIFactory.NewWidget <IListViewer>(gridComposite);

            gridComposite.AddWidget(listViewer);

            IViewReference selectedViewReference = null;
            bool           closedOk = false;

            listViewer.ContentProvider = new ListViewerContentProviderImpl();
            listViewer.LabelProvider   = new ListViewerLabelProviderImpl();
            listViewer.Input           = DataViewRegistry.Instance.GetViewReferences().OrderBy(view => view.Title).ToArray();
            listViewer.Update();
            listViewer.SelectionChanged += (sender, args) => selectedViewReference = (IViewReference)args.Selection;
            dialogWindow.AddButton(Messages.WindowMenuShowViewsMenuHandler_DialogButtonCancel,
                                   new ActionHandlerDelegate(() => dialogWindow.Close()));
            dialogWindow.AddButton(Messages.WindowMenuShowViewsMenuHandler_DialogButtonOk,
                                   new ActionHandlerDelegate(() => {
                closedOk = true;
                dialogWindow.Close();
            }));

            dialogWindow.SetContent(gridComposite);
            dialogWindow.Show(true);

            if (closedOk && selectedViewReference != null)
            {
                string viewId = selectedViewReference.Id;
                PlatformUI.Instance.Workbench.ActivePerspective.OpenView(viewId, EViewPosition.Bottom);
            }
        }