// 1.3 cmdidShowHideModelTipsContextMenuCommand internal virtual void OnStatusShowHideModelTips(object sender, System.EventArgs e) { // For now - always shown global::System.ComponentModel.Design.MenuCommand cmd = sender as global::System.ComponentModel.Design.MenuCommand; if (null != cmd) { cmd.Visible = true; cmd.Enabled = true; } }
// Command menu constants... // 1) Diagram menu - commands for the DSL diagram // // 1.1 cmdidIncrementEventVersionContextMenuCommand internal virtual void OnStatusIncrementEventVersion(object sender, System.EventArgs e) { global::System.ComponentModel.Design.MenuCommand cmd = sender as global::System.ComponentModel.Design.MenuCommand; cmd.Visible = cmd.Enabled = false; if (this.CurrentSelection.OfType <EventDefinitionCompartmentShape>().Count() == 1) { // One and only one "Event" selected so show the Increment version command cmd.Visible = cmd.Enabled = true; } }
// 1.2 cmdidExpandCollapseAggregateContextMenuCommand internal virtual void OnStatusExpandCollapseAggregate(object sender, System.EventArgs e) { global::System.ComponentModel.Design.MenuCommand cmd = sender as global::System.ComponentModel.Design.MenuCommand; cmd.Visible = true; cmd.Enabled = false; if (this.CurrentSelection.OfType <AggregateGeometryShape>().Count() == 1) { // One and only one "Aggregate" selected so show the expand/collapse command cmd.Enabled = true; } }
private void OnStatusAddAggregateInstanceMenuCommand(object sender, EventArgs e) { global::System.ComponentModel.Design.MenuCommand cmd = sender as global::System.ComponentModel.Design.MenuCommand; cmd.Visible = false; cmd.Enabled = false; if (this.CurrentSelection.OfType <AggregateGeometryShape>().Count() == 1) { // One and only one "Aggregate" selected so show the "Add aggregate instance" command cmd.Visible = true; cmd.Enabled = true; } }
/// <summary> /// Status event handler for validating the current selection. /// </summary> internal virtual void OnStatusValidate(object sender, System.EventArgs e) { global::System.ComponentModel.Design.MenuCommand cmd = sender as global::System.ComponentModel.Design.MenuCommand; cmd.Visible = cmd.Enabled = false; foreach (object selectedObject in this.CurrentSelection) { DslModeling::ModelElement element = GetValidationTarget(selectedObject); if (element != null) { cmd.Visible = cmd.Enabled = true; break; } } }
// 3) Documentation generation internal void OnStatusGenerateCQRSModelDocumentation(object sender, EventArgs e) { global::System.ComponentModel.Design.MenuCommand cmd = sender as global::System.ComponentModel.Design.MenuCommand; if (null != cmd) { cmd.Visible = true; if (this.IsCurrentDiagramEmpty()) { cmd.Enabled = false; } else { cmd.Enabled = true; } } }
/// <summary> /// Get the set of commands for this CQRS/DSL tool /// </summary> protected override IList <MenuCommand> GetMenuCommands() { // Get the standard base commands global::System.Collections.Generic.IList <global::System.ComponentModel.Design.MenuCommand> commands = base.GetMenuCommands(); // Add custom commands global::System.ComponentModel.Design.MenuCommand menuCommand = null; // Add handler for "Show/Hide tooltips" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusShowHideModelTips), new EventHandler(OnMenuShowHideModelTips), new CommandID(guidCustomDiagramMenuCmdSet, cmdidShowHideModelTipsContextMenuCommand)); commands.Add(menuCommand); // Add handler for "Increment event version" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusIncrementEventVersion), new EventHandler(OnMenuIncrementEventVersion), new CommandID(guidCustomDiagramMenuCmdSet, cmdidIncrementEventVersionContextMenuCommand)); commands.Add(menuCommand); // Add handler for "Expand / CollapseAggregate" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusExpandCollapseAggregate), new EventHandler(OnMenuExpandCollapseAggregate), new CommandID(guidCustomDiagramMenuCmdSet, cmdidExpandCollapseAggregateContextMenuCommand)); commands.Add(menuCommand); // Add handler for "Generate code" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusGenerateCQRSModelCode), new EventHandler(OnMenuGenerateCQRSModelCode), new CommandID(guidCustomDiagramMenuCmdSet, cmdidGenerateCQRSModelCode)); commands.Add(menuCommand); // Add handler for "Generate documentation" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusGenerateCQRSModelDocumentation), new EventHandler(OnMenuGenerateCQRSModelDocumentation), new CommandID(guidCustomDiagramMenuCmdSet, cmdidGenerateCQRSModelDocumentation)); commands.Add(menuCommand); // return the resulting list return(commands); }
/// <summary> /// Get the set of commands for this CQRS/DSL tool /// </summary> protected override IList <MenuCommand> GetMenuCommands() { // Get the standard base commands global::System.Collections.Generic.IList <global::System.ComponentModel.Design.MenuCommand> commands = base.GetMenuCommands(); // Add custom commands global::System.ComponentModel.Design.MenuCommand menuCommand = null; // Add handler for "Show/Hide tooltips" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusShowHideModelTips), new EventHandler(OnMenuShowHideModelTips), new CommandID(guidCustomDiagramMenuCmdSet, cmdidShowHideModelTipsContextMenuCommand)); commands.Add(menuCommand); // Add handler for "Increment event version" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusIncrementEventVersion), new EventHandler(OnMenuIncrementEventVersion), new CommandID(guidCustomDiagramMenuCmdSet, cmdidIncrementEventVersionContextMenuCommand)); commands.Add(menuCommand); // Add handler for "Expand / CollapseAggregate" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusExpandCollapseAggregate), new EventHandler(OnMenuExpandCollapseAggregate), new CommandID(guidCustomDiagramMenuCmdSet, cmdidExpandCollapseAggregateContextMenuCommand)); commands.Add(menuCommand); // Add handler for the "Model properties" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusModelProperties), new EventHandler(OnMenuModelProperties), new CommandID(guidCustomDiagramMenuCmdSet, cmdidModelSettings)); commands.Add(menuCommand); // Add handler for "Generate code" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusGenerateCQRSModelCode), new EventHandler(OnMenuGenerateCQRSModelCode), new CommandID(guidCustomDiagramMenuCmdSet, cmdidGenerateCQRSModelCode)); commands.Add(menuCommand); // Add handler for "Generate documentation" menu command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusGenerateCQRSModelDocumentation), new EventHandler(OnMenuGenerateCQRSModelDocumentation), new CommandID(guidCustomDiagramMenuCmdSet, cmdidGenerateCQRSModelDocumentation)); commands.Add(menuCommand); // Add handler for the "Data" top level menu menuCommand = new MenuCommand( new EventHandler(OnMenuDataTopLevelMenuCommand), new CommandID(guidCustomDiagramMenuCmdSet, cmdidDataTopLevelMenuCommand)); commands.Add(menuCommand); // Add handler for "AddAggregateInstance" Menu Command menuCommand = new DynamicStatusMenuCommand(new EventHandler(OnStatusAddAggregateInstanceMenuCommand), new EventHandler(OnMenuAddAggregateInstanceMenuCommand), new CommandID(guidCustomDiagramMenuCmdSet, cmdidDataAddAggregateInstanceMenuCommand)); commands.Add(menuCommand); // Add handler for "AddEventToAggregateInstance" Menu Command // Add handler for "ShowEventsForAggregateInstance" Menu Command // Add handler for "RunProjectionForAggregateInstance" Menu Command // Add handler for "RunClassifierForAggregateInstance" Menu Command // Add handler for "ShowIdentifierGroupMembers" Menu Command // Add handler for "RunQueryForIdentifierGroup" Menu Command // Add handler for "RunCommandForIdentifierGroup" Menu Command // add handler for the "DataImport" menu command menuCommand = new MenuCommand(new EventHandler(OnDataImportMenuCommand), new CommandID(guidCustomDiagramMenuCmdSet, cmdidDataImportpMenuCommand)); commands.Add(menuCommand); // add handler for the DataExport command // return the resulting list return(commands); }