Exemplo n.º 1
0
        /// <inheritdoc />
        protected override void OnDispose(bool dispose)
        {
            try {
                OnDispose();

                for (int i = -1; ++i != _wizardPages.Count;)
                {
                    IWizardPage page = _wizardPages[i];
                    page.Wizard = null;
                    page.Dispose();
                }

                _wizardPages.Clear();
                _pageToCompositeMap.Clear();

                if (_currentWizardPage != null)
                {
                    _currentWizardPage.PropertyChanged -= OnPagePropertyChanged;
                    _currentWizardPage = null;
                }

                _btnFinish = null;
                _btnNext   = null;
                _btnPrev   = null;

                _dialog.SetContent(null);
                _dialog = null;
            } catch {
                // Does not matter
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        protected override void OnCancel()
        {
            ITitledAreaDialog dialog        = UIFactory.NewViewPart <ITitledAreaDialog>();
            IGridComposite    gridComposite = UIFactory.NewWidget <IGridComposite>();

            gridComposite.GridColumns = 1;
            gridComposite.GridRows    = 1;
            gridComposite.AddWidget(new Canvas {
                ShowGrid = true
            });
            dialog.ContentPane = gridComposite;
            dialog.Show();
        }
        /// <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);
            }
        }