Ejemplo 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
            }
        }
        /// <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);
            }
        }