/// <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); } }
/// <inheritdoc /> public virtual void Cancel() { OnCancel(); _dialog.Close(); }
/// <summary> /// Tells the wizard to cancel. /// </summary> public void Cancel() { OnCancel(); iDialog.Close(); }