public ColumnInfoMenu(RDMPContextMenuStripArgs args, ColumnInfo columnInfo) : base(args, columnInfo) { var miViewData = new ToolStripMenuItem("View Data"); Items.Add(miViewData); Add(new ExecuteCommandViewData(_activator, ViewType.TOP_100, columnInfo), Keys.None, miViewData); Add(new ExecuteCommandViewData(_activator, ViewType.Aggregate, columnInfo), Keys.None, miViewData); Add(new ExecuteCommandViewData(_activator, ViewType.Distribution, columnInfo), Keys.None, miViewData); Add(new ExecuteCommandAddNewLookupTableRelationship(_activator, null, columnInfo.TableInfo)); Items.Add(new ToolStripSeparator()); Add(new ExecuteCommandAddJoinInfo(_activator, columnInfo.TableInfo)); Add(new ExecuteCommandAnonymiseColumnInfo(_activator, columnInfo)); Add(new ExecuteCommandAlterColumnType(_activator, columnInfo), Keys.None, Alter); var miIgnore = AtomicCommandUIFactory.CreateMenuItem(new ExecuteCommandSet(_activator, columnInfo, typeof(ColumnInfo).GetProperty(nameof(ColumnInfo.IgnoreInLoads)))); miIgnore.Checked = columnInfo.IgnoreInLoads; miIgnore.Text = "Ignore In Loads"; Items.Add(miIgnore); }
public RDMPSingleControlTabMenu(IActivateItems activator, RDMPSingleControlTab tab, WindowManager windowManager) { _tab = tab; Items.Add("Close Tab", null, (s, e) => tab.Close()); Items.Add("Close All Tabs", null, (s, e) => windowManager.CloseAllWindows(tab)); Items.Add("Close All But This", null, (s, e) => windowManager.CloseAllButThis(tab)); Items.Add("Show", null, (s, e) => tab.HandleUserRequestingEmphasis(activator)); if (tab is PersistableSingleDatabaseObjectDockContent single) { var uiFactory = new AtomicCommandUIFactory(activator); var builder = new GoToCommandFactory(activator); var gotoMenu = new ToolStripMenuItem(AtomicCommandFactory.GoTo) { Enabled = false }; Items.Add(gotoMenu); foreach (var cmd in builder.GetCommands(single.DatabaseObject)) { gotoMenu.DropDownItems.Add(uiFactory.CreateMenuItem(cmd)); gotoMenu.Enabled = true; } RDMPContextMenuStrip.RegisterFetchGoToObjecstCallback(gotoMenu); } Items.Add("Refresh", FamFamFamIcons.arrow_refresh, (s, e) => _tab.HandleUserRequestingTabRefresh(activator)); var help = new ToolStripMenuItem("Help", FamFamFamIcons.help, (s, e) => _tab.ShowHelp(activator)); help.ShortcutKeys = Keys.F1; Items.Add(help); }
protected ToolStripMenuItem GetMenuItem(IAtomicCommand cmd) { if (_atomicCommandUIFactory == null) { _atomicCommandUIFactory = new AtomicCommandUIFactory(ItemActivator); } return(_atomicCommandUIFactory.CreateMenuItem(cmd)); }
public void SetUp(IActivateItems activator, string title, Type openType, AtomicCommandUIFactory factory, params IAtomicCommand[] newCommands) { _openType = openType; if (!_doneSetup) { _activator = activator; lblTitle.Text = title; btnNew.Image = FamFamFamIcons.add; btnNew.Text = "New"; btnNew.DisplayStyle = ToolStripItemDisplayStyle.Text; btnNewDropdown.Image = FamFamFamIcons.add; btnNewDropdown.Text = "New..."; btnNewDropdown.DisplayStyle = ToolStripItemDisplayStyle.Text; btnOpen.Text = "Open"; btnOpen.DisplayStyle = ToolStripItemDisplayStyle.Text; btnOpen.Click += (s, e) => { var ui = new NavigateToObjectUI(activator); ui.AlwaysFilterOn = openType; ui.CompletionAction = Open; ui.Show(); }; //if there's only one command for new if (newCommands.Length == 1) { //don't use the dropdown toolStrip1.Items.Remove(btnNewDropdown); btnNew.Click += (s, e) => newCommands.Single().Execute(); } else { toolStrip1.Items.Remove(btnNew); btnNewDropdown.DropDownItems.AddRange(newCommands.Select(factory.CreateMenuItem).Cast <ToolStripItem>().ToArray()); } olvName.AspectGetter = (o) => ((HistoryEntry)o).Object.ToString(); CommonTreeFunctionality.SetUp(RDMPCollection.None, olvRecent, activator, olvName, olvName, new RDMPCollectionCommonFunctionalitySettings() { SuppressChildrenAdder = true }); _doneSetup = true; } RefreshHistory(); }
public override void SetItemActivator(IActivateItems activator) { base.SetItemActivator(activator); //important to register the setup before the lifetime subscription so it gets priority on events CommonTreeFunctionality.SetUp( RDMPCollection.Cohort, tlvCohortIdentificationConfigurations, Activator, olvName, //column with the icon olvName //column that can be renamed ); CommonTreeFunctionality.AxeChildren = new Type[] { typeof(CohortIdentificationConfiguration) }; var dataExportChildProvider = activator.CoreChildProvider as DataExportChildProvider; if (dataExportChildProvider == null) { CommonTreeFunctionality.MaintainRootObjects = new Type[] { typeof(CohortIdentificationConfiguration) }; tlvCohortIdentificationConfigurations.AddObjects(Activator.CoreChildProvider.AllCohortIdentificationConfigurations); } else { CommonTreeFunctionality.MaintainRootObjects = new Type[] { typeof(AllProjectCohortIdentificationConfigurationsNode), typeof(AllFreeCohortIdentificationConfigurationsNode) }; tlvCohortIdentificationConfigurations.AddObject(dataExportChildProvider.AllProjectCohortIdentificationConfigurationsNode); tlvCohortIdentificationConfigurations.AddObject(dataExportChildProvider.AllFreeCohortIdentificationConfigurationsNode); } tlvCohortIdentificationConfigurations.AddObject(Activator.CoreChildProvider.OrphanAggregateConfigurationsNode); CommonTreeFunctionality.WhitespaceRightClickMenuCommandsGetter = (a) => new IAtomicCommand[] { new ExecuteCommandCreateNewCohortIdentificationConfiguration(a), new ExecuteCommandMergeCohortIdentificationConfigurations(a, null) }; Activator.RefreshBus.EstablishLifetimeSubscription(this); var factory = new AtomicCommandUIFactory(activator); CommonFunctionality.Add(factory.CreateMenuItem(new ExecuteCommandCreateNewCohortIdentificationConfiguration(Activator)), "New..."); CommonFunctionality.Add(factory.CreateMenuItem(new ExecuteCommandMergeCohortIdentificationConfigurations(Activator, null) { OverrideCommandName = "By Merging Existing..." }), "New..."); }
public void SetWindowManager(WindowManager windowManager) { SetItemActivator(windowManager.ActivateItems); _windowManager = windowManager; _atomicCommandUIFactory = new AtomicCommandUIFactory(Activator); //top menu strip setup / adjustment LocationsMenu.DropDownItems.Add(new DataExportMenu(Activator)); _saveToolStripMenuItem = new SaveMenuItem { Enabled = false, Name = "saveToolStripMenuItem", Size = new System.Drawing.Size(214, 22) }; fileToolStripMenuItem.DropDownItems.Insert(3, _saveToolStripMenuItem); _windowManager.TabChanged += WindowFactory_TabChanged; _windowManager.Navigation.Changed += (s, e) => UpdateForwardBackEnabled(); var tracker = new TutorialTracker(Activator); foreach (Tutorial t in tracker.TutorialsAvailable) { tutorialsToolStripMenuItem.DropDownItems.Add(new LaunchTutorialMenuItem(tutorialsToolStripMenuItem, Activator, t, tracker)); } tutorialsToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator()); tutorialsToolStripMenuItem.DropDownItems.Add(new DisableTutorialsMenuItem(tutorialsToolStripMenuItem, tracker)); tutorialsToolStripMenuItem.DropDownItems.Add(new ResetTutorialsMenuItem(tutorialsToolStripMenuItem, tracker)); closeToolStripMenuItem.Enabled = false; rdmpTaskBar1.SetWindowManager(_windowManager); // Location menu LocationsMenu.DropDownItems.Add(_atomicCommandUIFactory.CreateMenuItem(new ExecuteCommandChoosePlatformDatabase(Activator.RepositoryLocator))); Activator.Theme.ApplyTo(menuStrip1); }
public RDMPContextMenuStrip(RDMPContextMenuStripArgs args, object o) { _o = o; _args = args; //we will add this ourselves in AddCommonMenuItems _args.SkipCommand <ExecuteCommandActivate>(); _activator = _args.ItemActivator; _activator.Theme.ApplyTo(this); AtomicCommandUIFactory = new AtomicCommandUIFactory(_activator); RepositoryLocator = _activator.RepositoryLocator; if (o != null && !(o is RDMPCollection)) { ActivateCommandMenuItem = Add(new ExecuteCommandActivate(_activator, args.Masquerader ?? o), Keys.None); } }
public RDMPContextMenuStrip(RDMPContextMenuStripArgs args, object o) { _o = o; _args = args; _activator = _args.ItemActivator; _activator.Theme.ApplyTo(this); AtomicCommandUIFactory = new AtomicCommandUIFactory(_activator); RepositoryLocator = _activator.RepositoryLocator; if (o != null && !(o is RDMPCollection)) { ActivateCommandMenuItem = Add(new ExecuteCommandActivate(_activator, args.Masquerader ?? o)); } if (o is DatabaseEntity e) { var export = _activator.RepositoryLocator.CatalogueRepository.GetReferencesTo <ObjectExport>(e).FirstOrDefault(); if (export != null) { Add(new ExecuteCommandShow(_activator, export, 0, true) { OverrideCommandName = "Show Export Definition" }, Keys.None, GoTo); } var import = _activator.RepositoryLocator.CatalogueRepository.GetReferencesTo <ObjectImport>(e).FirstOrDefault(); if (import != null) { Add(new ExecuteCommandShow(_activator, import, 0) { OverrideCommandName = "Show Import Definition" }, Keys.None, GoTo); } } }
public LoadMetadataMenu(RDMPContextMenuStripArgs args, LoadMetadata loadMetadata) : base(args, loadMetadata) { Add(new ExecuteCommandViewLogs(_activator, loadMetadata)); Add(new ExecuteCommandViewLoadDiagram(_activator, loadMetadata)); Add(new ExecuteCommandEditLoadMetadataDescription(_activator, loadMetadata)); Add(new ExecuteCommandExportObjectsToFileUI(_activator, new IMapsDirectlyToDatabaseTable[] { loadMetadata })); Items.Add(new ToolStripSeparator()); Add(new ExecuteCommandOverrideRawServer(_activator, loadMetadata)); Add(new ExecuteCommandCreateNewLoadMetadata(_activator)); var mi_advanced = new ToolStripMenuItem("Advanced"); Add(new ExecuteCommandSetGlobalDleIgnorePattern(_activator), Keys.None, mi_advanced); Add(new ExecuteCommandSetIgnoredColumns(_activator, loadMetadata), Keys.None, mi_advanced); Add(new ExecuteCommandSetIgnoredColumns(_activator, loadMetadata, null) { OverrideCommandName = "Clear Ignored Columns" }, Keys.None, mi_advanced); var mi_ignoreTrigger = AtomicCommandUIFactory.CreateMenuItem( new ExecuteCommandSet(_activator, loadMetadata, typeof(LoadMetadata).GetProperty(nameof(LoadMetadata.IgnoreTrigger))) { OverrideCommandName = "Ignore Trigger" } ); mi_ignoreTrigger.Checked = loadMetadata.IgnoreTrigger; mi_advanced.DropDownItems.Add(mi_ignoreTrigger); Items.Add(mi_advanced); ReBrandActivateAs("Check and Execute", RDMPConcept.LoadMetadata, OverlayKind.Execute); }
private void SetupToolStrip() { CommonFunctionality.ClearToolStrip(); CommonFunctionality.Add(new ExecuteCommandCreateNewDataExtractionProject(Activator),"Project",null,"New..."); CommonFunctionality.Add(new ExecuteCommandCreateNewExtractionConfigurationForProject(Activator),"Extraction",null,"New..."); CommonFunctionality.Add(new ExecuteCommandCreateNewExtractableDataSetPackage(Activator),"Package",null,"New..."); var mi = new ToolStripMenuItem("Project Specific Catalogue",Activator.CoreIconProvider.GetImage(RDMPConcept.ProjectCatalogue,OverlayKind.Add)); var factory = new AtomicCommandUIFactory(Activator); mi.DropDownItems.Add(factory.CreateMenuItem(new ExecuteCommandCreateNewCatalogueByImportingFileUI(Activator) { OverrideCommandName = "From File...", PromptForProject = true })); mi.DropDownItems.Add(factory.CreateMenuItem(new ExecuteCommandCreateNewCatalogueByImportingExistingDataTable(Activator) { OverrideCommandName = "From Database...", PromptForProject = true })); CommonFunctionality.Add(mi,"New..."); }
public RDMPContextMenuStrip(RDMPContextMenuStripArgs args, object o) { _o = o; _args = args; _activator = _args.ItemActivator; _activator.Theme.ApplyTo(this); AtomicCommandUIFactory = new AtomicCommandUIFactory(_activator); RepositoryLocator = _activator.RepositoryLocator; if (o != null && !(o is RDMPCollection)) { ActivateCommandMenuItem = Add(new ExecuteCommandActivate(_activator, args.Masquerader ?? o)); } if (o is DatabaseEntity e) { var gotoMenuBuilder = new GoToMenuBuilder(_activator); Items.Add(gotoMenuBuilder.GetMenu(e)); } }
public GoToMenuBuilder(IActivateItems activator) { _activator = activator; _commandFactory = new AtomicCommandUIFactory(activator); }
private ContextMenuStrip GetMenuIfExists(object o) { var many = o as ICollection; if (many != null) { var menu = new ContextMenuStrip(); var factory = new AtomicCommandUIFactory(_activator); if (many.Cast <object>().All(d => d is IDeleteable)) { var mi = factory.CreateMenuItem(new ExecuteCommandDelete(_activator, many.Cast <IDeleteable>().ToList())); mi.ShortcutKeys = Keys.Delete; menu.Items.Add(mi); } return(menu); } if (o != null) { //is o masquerading as someone else? IMasqueradeAs masquerader = o as IMasqueradeAs; //if so this is who he is pretending to be object masqueradingAs = null; if (masquerader != null) { masqueradingAs = masquerader.MasqueradingAs(); //yes he is masquerading! } var menu = GetMenuWithCompatibleConstructorIfExists(o); //If no menu takes the object o try checking the object it is masquerading as as a secondary preference if (menu == null && masqueradingAs != null) { menu = GetMenuWithCompatibleConstructorIfExists(masqueradingAs, masquerader); } //found a menu with compatible constructor arguments if (menu != null) { if (!Settings.AllowPinning) { var miPin = menu.Items.OfType <AtomicCommandMenuItem>().SingleOrDefault(mi => mi.Tag is ExecuteCommandPin); if (miPin != null) { miPin.Enabled = false; miPin.ToolTipText = "Pinning is disabled in this collection"; } } return(menu); } //no compatible menus so just return default menu var defaultMenu = new RDMPContextMenuStrip(new RDMPContextMenuStripArgs(_activator, Tree, o), o); defaultMenu.AddCommonMenuItems(this); return(defaultMenu); } else { //it's a right click in whitespace (nothing right clicked) AtomicCommandUIFactory factory = new AtomicCommandUIFactory(_activator); if (WhitespaceRightClickMenuCommandsGetter != null) { var menu = factory.CreateMenu(_activator, Tree, _collection, WhitespaceRightClickMenuCommandsGetter(_activator)); menu.AddCommonMenuItems(this); return(menu); } } return(null); }
public void SetWindowManager(WindowManager windowManager) { SetItemActivator(windowManager.ActivateItems); _windowManager = windowManager; _atomicCommandUIFactory = new AtomicCommandUIFactory(Activator); //top menu strip setup / adjustment LocationsMenu.DropDownItems.Add(new DataExportMenu(Activator)); _saveToolStripMenuItem = new SaveMenuItem { Enabled = false, Name = "saveToolStripMenuItem", Size = new System.Drawing.Size(214, 22) }; fileToolStripMenuItem.DropDownItems.Insert(3, _saveToolStripMenuItem); _windowManager.TabChanged += WindowFactory_TabChanged; _windowManager.Navigation.Changed += (s, e) => UpdateForwardBackEnabled(); var tracker = new TutorialTracker(Activator); foreach (Tutorial t in tracker.TutorialsAvailable) { tutorialsToolStripMenuItem.DropDownItems.Add(new LaunchTutorialMenuItem(tutorialsToolStripMenuItem, Activator, t, tracker)); } tutorialsToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator()); tutorialsToolStripMenuItem.DropDownItems.Add(new DisableTutorialsMenuItem(tutorialsToolStripMenuItem, tracker)); tutorialsToolStripMenuItem.DropDownItems.Add(new ResetTutorialsMenuItem(tutorialsToolStripMenuItem, tracker)); closeToolStripMenuItem.Enabled = false; rdmpTaskBar1.SetWindowManager(_windowManager); // Location menu instancesToolStripMenuItem.DropDownItems.Add(_atomicCommandUIFactory.CreateMenuItem( new ExecuteCommandChoosePlatformDatabase(Activator.RepositoryLocator) { OverrideCommandName = "Change Default Instance" })); Activator.Theme.ApplyTo(menuStrip1); try { BuildSwitchInstanceMenuItems(); } catch (Exception ex) { Activator.GlobalErrorCheckNotifier.OnCheckPerformed( new CheckEventArgs("Failed to BuildSwitchInstanceMenuItems", CheckResult.Fail, ex)); } launchAnotherInstanceToolStripMenuItem.ToolTipText = "Start another copy of the RDMP process targetting the same (or another) RDMP platform database"; if (switchToInstanceToolStripMenuItem.DropDownItems.Count > 1) { switchToInstanceToolStripMenuItem.Enabled = true; switchToInstanceToolStripMenuItem.ToolTipText = "Close the application and start another copy of the RDMP process targetting another RDMP platform database"; } else { switchToInstanceToolStripMenuItem.Enabled = false; switchToInstanceToolStripMenuItem.ToolTipText = "There are no other RDMP platform databases configured, create a .yaml file with connection strings to enable this feature"; } }
public HomeUI(IActivateItems activator) { _activator = activator; _uiFactory = new AtomicCommandUIFactory(activator); InitializeComponent(); }
/// <summary> /// Creates a menu compatible with object <paramref name="o"/>. Returns null if no compatible menu exists. /// Errors are reported to <see cref="IBasicActivateItems.GlobalErrorCheckNotifier"/> (if set up). /// /// </summary> /// <param name="o"></param> /// <returns></returns> public ContextMenuStrip GetMenuIfExists(object o) { try { var many = o as ICollection; if (many != null) { var menu = new ContextMenuStrip(); var factory = new AtomicCommandUIFactory(_activator); if (many.Cast <object>().All(d => d is IDisableable)) { var mi = factory.CreateMenuItem(new ExecuteCommandDisableOrEnable(_activator, many.Cast <IDisableable>().ToArray())); menu.Items.Add(mi); } if (many.Cast <object>().All(d => d is IDeleteable)) { var mi = factory.CreateMenuItem(new ExecuteCommandDelete(_activator, many.Cast <IDeleteable>().ToArray())); mi.ShortcutKeys = Keys.Delete; menu.Items.Add(mi); } MenuBuilt?.Invoke(this, new MenuBuiltEventArgs(menu, o)); return(menu); } if (o != null) { //is o masquerading as someone else? IMasqueradeAs masquerader = o as IMasqueradeAs; //if so this is who he is pretending to be object masqueradingAs = null; if (masquerader != null) { masqueradingAs = masquerader.MasqueradingAs(); //yes he is masquerading! } var menu = GetMenuWithCompatibleConstructorIfExists(o); //If no menu takes the object o try checking the object it is masquerading as as a secondary preference if (menu == null && masqueradingAs != null) { menu = GetMenuWithCompatibleConstructorIfExists(masqueradingAs, masquerader); } //found a menu with compatible constructor arguments if (menu != null) { if (!Settings.AllowPinning) { var miPin = menu.Items.OfType <AtomicCommandMenuItem>().SingleOrDefault(mi => mi.Tag is ExecuteCommandPin); if (miPin != null) { miPin.Enabled = false; miPin.ToolTipText = "Pinning is disabled in this collection"; } } MenuBuilt?.Invoke(this, new MenuBuiltEventArgs(menu, o)); return(menu); } //no compatible menus so just return default menu var defaultMenu = new RDMPContextMenuStrip(new RDMPContextMenuStripArgs(_activator, Tree, o), o); defaultMenu.AddCommonMenuItems(this); MenuBuilt?.Invoke(this, new MenuBuiltEventArgs(defaultMenu, o)); return(defaultMenu); } else { //it's a right click in whitespace (nothing right clicked) AtomicCommandUIFactory factory = new AtomicCommandUIFactory(_activator); if (WhitespaceRightClickMenuCommandsGetter != null) { var menu = factory.CreateMenu(_activator, Tree, _collection, WhitespaceRightClickMenuCommandsGetter(_activator)); menu.AddCommonMenuItems(this); return(menu); } } return(null); } catch (Exception ex) { if (_activator?.GlobalErrorCheckNotifier == null) { throw; } _activator.GlobalErrorCheckNotifier.OnCheckPerformed(new CheckEventArgs($"Failed to build menu for {o} of Type {o?.GetType()}", CheckResult.Fail, ex)); return(null); } }
public void SetItemActivator(IActivateItems activator) { _activator = activator; atomicCommandUIFactory = new AtomicCommandUIFactory(_activator); _activator.Theme.ApplyTo(ToolStrip); }
protected RDMPToolStripMenuItem(IActivateItems activator, string text) : base(text) { _activator = activator; AtomicCommandUIFactory = new AtomicCommandUIFactory(activator); }