public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.Add(new NewSRCommand(mainWindow, selection)); items.AddIfEnabled(new RemoveStorageLinkSystemCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new VappStartCommand(mainWindow, selection)); items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new RepairSRCommand(mainWindow, selection)); items.AddIfEnabled(new SetAsDefaultSRCommand(mainWindow, selection)); items.AddIfEnabled(new ConvertToThinSRCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new DetachSRCommand(mainWindow, selection)); items.AddIfEnabled(new ReattachSRCommand(mainWindow, selection)); items.AddIfEnabled(new ForgetSRCommand(mainWindow, selection)); items.AddIfEnabled(new DestroySRCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.storage, selection); items.AddSeparator(); items.AddIfEnabled(new PropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new PowerOnHostCommand(mainWindow, selection)); items.AddIfEnabled(new DestroyHostCommand(mainWindow, selection)); if (selection.Count == 1) { items.AddSeparator(); items.AddIfEnabled(new HostPropertiesCommand(mainWindow, selection)); } }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new NewVMFromSnapshotCommand(mainWindow, selection)); items.AddIfEnabled(new NewTemplateFromSnapshotCommand(mainWindow, selection)); items.AddIfEnabled(new ExportSnapshotAsTemplateCommand(mainWindow, selection)); items.AddIfEnabled(new DeleteSnapshotCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.vm, selection); items.AddSeparator(); items.AddIfEnabled(new PropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new AddSelectedHostToPoolToolStripMenuItem(mainWindow, selection, true)); items.AddIfEnabled(new DisconnectHostCommand(mainWindow, selection)); items.AddIfEnabled(new RebootHostCommand(mainWindow, selection)); items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection)); items.AddIfEnabled(new RestartToolstackCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); items.AddSeparator(); items.AddPluginItems(PluginContextMenu.server, selection); items.AddSeparator(); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { Host host = (Host)selection[0].XenObject; items.AddIfEnabled(new NewVMCommand(mainWindow, selection)); items.AddIfEnabled(new NewSRCommand(mainWindow, selection)); items.AddIfEnabled(new ImportCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new AddSelectedHostToPoolToolStripMenuItem(mainWindow, selection, true)); items.AddSeparator(); items.AddIfEnabled(new HostMaintenanceModeCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new RebootHostCommand(mainWindow, selection)); items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection)); items.AddIfEnabled(new PowerOnHostCommand(mainWindow, selection)); items.AddIfEnabled(new RestartToolstackCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new RemoveHostCrashDumpsCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new DisconnectHostCommand(mainWindow, selection)); items.AddIfEnabled(new HostReconnectAsCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.server, selection); items.AddSeparator(); items.AddIfEnabled(new HostPropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new StartDockerContainerCommand(mainWindow, selection)); items.AddIfEnabled(new StopDockerContainerCommand(mainWindow, selection)); items.AddIfEnabled(new PauseDockerContainerCommand(mainWindow, selection)); items.AddIfEnabled(new ResumeDockerContainerCommand(mainWindow, selection)); items.AddIfEnabled(new RestartDockerContainerCommand(mainWindow, selection)); }
/// <summary> /// Builds the context menu for the specified selection. /// </summary> /// <param name="selection">The selection for which the context menu items are required.</param> /// <returns>The context menu items.</returns> public ToolStripItem[] Build(IEnumerable<SelectedItem> selection) { Util.ThrowIfParameterNull(selection, "selection"); foreach (Builder builder in Builders) { SelectedItemCollection selectionList = new SelectedItemCollection(selection); if (builder.IsValid(selectionList)) { ContextMenuItemCollection items = new ContextMenuItemCollection(_mainWindow, _pluginManager); builder.Build(_mainWindow, selectionList, items); CheckAccessKeys(items); items.RemoveInvalidSeparators(); return items.ToArray(); } } return new ToolStripItem[0]; }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new ShutDownVMCommand(mainWindow, selection)); items.AddIfEnabled(new StartVMCommand(mainWindow, selection)); items.AddIfEnabled(new ResumeVMCommand(mainWindow, selection)); items.AddIfEnabled(new SuspendVMCommand(mainWindow, selection)); items.AddIfEnabled(new RebootVMCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new ForceVMShutDownCommand(mainWindow, selection)); items.AddIfEnabled(new ForceVMRebootCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new InstallToolsCommand(mainWindow, selection)); items.AddIfEnabled(new DeleteVMCommand(mainWindow, selection)); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.vm, selection); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new DeleteTagCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new ShutDownVMCommand(mainWindow, selection)); items.AddIfEnabled(new StartVMCommand(mainWindow, selection)); items.AddIfEnabled(new ResumeVMCommand(mainWindow, selection)); items.AddIfEnabled(new SuspendVMCommand(mainWindow, selection)); items.AddIfEnabled(new RebootVMCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new ForceVMShutDownCommand(mainWindow, selection)); items.AddIfEnabled(new ForceVMRebootCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new VappStartCommand(mainWindow, selection)); items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new StartVMOnHostToolStripMenuItem(mainWindow, selection, true)); items.AddIfEnabled(new ResumeVMOnHostToolStripMenuItem(mainWindow, selection, true)); items.AddIfEnabled(new MigrateVMToolStripMenuItem(mainWindow, selection, true)); items.AddIfEnabled(new ExportCommand(mainWindow, selection)); items.AddIfEnabled(new AssignGroupToolStripMenuItem<VMPP>(mainWindow, selection, true)); items.AddIfEnabled(new AssignGroupToolStripMenuItem<VM_appliance>(mainWindow, selection, true)); items.AddSeparator(); items.AddIfEnabled(new InstallToolsCommand(mainWindow, selection)); items.AddIfEnabled(new DeleteVMCommand(mainWindow, selection)); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.vm, selection); }
public ContextMenu () { items = new ContextMenuItemCollection (); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.Add(new DestroySRCommand(mainWindow, selection)); items.Add(new ForgetSRCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { List<SelectedItem> inProgressItems = new List<SelectedItem>(); foreach (SelectedItem item in selection) { if (item.Connection != null && !item.Connection.IsConnected && item.Connection.InProgress) { inProgressItems.Add(item); } } if (inProgressItems.Count > 0) { items.Add(new CancelHostConnectionCommand(mainWindow, inProgressItems)); } else { items.AddIfEnabled(new DisconnectHostsAndPoolsCommand(mainWindow, selection), true); items.Add(new ReconnectHostCommand(mainWindow, selection), true); items.Add(new ForgetSavedPasswordCommand(mainWindow, selection)); items.Add(new RemoveHostCommand(mainWindow, selection)); items.AddIfEnabled(new RestartToolstackCommand(mainWindow, selection)); } }
private void CheckAccessKeys(ContextMenuItemCollection items) { List<string> usedKeys = new List<string>(); foreach (ToolStripItem item in items) { string text = item.Text.Replace("&&", ""); int index = text.IndexOf("&"); if (index >= 0) { string c = text[index + 1].ToString().ToLower(); if (usedKeys.Contains(c)) { Debug.Fail("Duplicated access key: " + c); } else { usedKeys.Add(c); } } } }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new DeleteVMsAndTemplatesCommand(mainWindow, selection)); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); }
public abstract void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items);
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { Host host = (Host)selection[0].XenObject; items.AddIfEnabled(new NewVMCommand(mainWindow, selection)); items.AddIfEnabled(new NewSRCommand(mainWindow, selection)); items.AddIfEnabled(new ImportCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new HostMaintenanceModeCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new RebootHostCommand(mainWindow, selection)); items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection)); items.AddIfEnabled(new RestartToolstackCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new RemoveHostCrashDumpsCommand(mainWindow, selection)); if (host != Helpers.GetMaster(host.Connection) ) { items.AddSeparator(); items.Add(new RemoveHostFromPoolCommand(mainWindow, selection)); } items.AddPluginItems(PluginContextMenu.server, selection); items.AddSeparator(); items.AddIfEnabled(new HostPropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new DisconnectHostsAndPoolsCommand(mainWindow, selection), true); items.AddIfEnabled(new ReconnectHostCommand(mainWindow, selection), true); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new ShutDownHostCommand(mainWindow, selection)); items.AddIfEnabled(new PowerOnHostCommand(mainWindow, selection)); items.AddIfEnabled(new RestartToolstackCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new DisconnectPoolCommand(mainWindow, selection), true); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.pool, selection); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.Add(new NewVMCommand(mainWindow, selection)); items.Add(new NewSRCommand(mainWindow, selection)); items.Add(new ImportCommand(mainWindow, selection)); items.AddSeparator(); if (selection.FirstAsXenObject != null ) items.Add(new HACommand(mainWindow, selection)); items.AddIfEnabled(new VMGroupCommand<VMPP>(mainWindow, selection)); items.AddIfEnabled(new VMGroupCommand<VM_appliance>(mainWindow, selection)); var drItem = new CommandToolStripMenuItem(new DRCommand(mainWindow, selection), true); if (drItem.Command.CanExecute()) { drItem.DropDownItems.Add(new CommandToolStripMenuItem( new DRConfigureCommand(mainWindow, selection), true)); drItem.DropDownItems.Add(new CommandToolStripMenuItem(new DisasterRecoveryCommand(mainWindow, selection), true)); items.Add(drItem); } var pool = selection.FirstAsXenObject as Pool; if (pool != null && !pool.IsPoolFullyUpgraded) items.Add(new RollingUpgradeCommand(mainWindow)); items.AddSeparator(); items.Add(new AddHostToSelectedPoolToolStripMenuItem(mainWindow, selection, true)); items.Add(new DisconnectPoolCommand(mainWindow, selection)); items.Add(new PoolReconnectAsCommand(mainWindow, selection)); items.AddSeparator(); items.AddPluginItems(PluginContextMenu.pool, selection); items.AddSeparator(); items.Add(new PoolPropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new RepairSRCommand(mainWindow, selection)); items.AddIfEnabled(new DetachSRCommand(mainWindow, selection)); items.AddIfEnabled(new ForgetSRCommand(mainWindow, selection)); items.AddIfEnabled(new DestroySRCommand(mainWindow, selection)); items.AddIfEnabled(new EditTagsCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new NewVMFromTemplateCommand(mainWindow, selection), true); items.AddIfEnabled(new InstantVMFromTemplateCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new ExportTemplateCommand(mainWindow, selection)); items.AddIfEnabled(new CopyTemplateCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new DeleteTemplateCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.template, selection); items.AddSeparator(); items.AddIfEnabled(new PropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { // Default behaviour of this command is very conservative, they wont be able to delete if there are multi vbds, // or if any of the vbds are plugged on top of the other constraints. items.Add(new DeleteVirtualDiskCommand(mainWindow, selection)); items.AddSeparator(); items.Add(new PropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { VM vm = (VM)selection[0].XenObject; items.AddIfEnabled(new ShutDownVMCommand(mainWindow, selection)); items.AddIfEnabled(new StartVMCommand(mainWindow, selection), vm.power_state == vm_power_state.Halted); items.AddIfEnabled(new ResumeVMCommand(mainWindow, selection)); items.AddIfEnabled(new SuspendVMCommand(mainWindow, selection)); items.AddIfEnabled(new RebootVMCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new ForceVMShutDownCommand(mainWindow, selection)); items.AddIfEnabled(new ForceVMRebootCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new VappStartCommand(mainWindow, selection)); items.AddIfEnabled(new VappShutDownCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new StartVMOnHostToolStripMenuItem(mainWindow, selection, true)); items.AddIfEnabled(new ResumeVMOnHostToolStripMenuItem(mainWindow, selection, true)); items.AddIfEnabled(new MigrateVMToolStripMenuItem(mainWindow, selection, true)); items.AddSeparator(); items.AddIfEnabled(new CopyVMCommand(mainWindow, selection)); items.AddIfEnabled(new MoveVMCommand(mainWindow, selection)); items.AddIfEnabled(new ExportCommand(mainWindow, selection)); items.AddIfEnabled(new TakeSnapshotCommand(mainWindow, selection)); items.AddIfEnabled(new ConvertVMToTemplateCommand(mainWindow, selection)); items.AddIfEnabled(new AssignGroupToolStripMenuItem<VMPP>(mainWindow, selection, true)); items.AddIfEnabled(new AssignGroupToolStripMenuItem<VM_appliance>(mainWindow, selection, true)); items.AddSeparator(); items.AddIfEnabled(new InstallToolsCommand(mainWindow, selection)); items.AddSeparator(); items.AddIfEnabled(new DeleteVMCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.vm, selection); items.AddSeparator(); items.AddIfEnabled(new PropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.Add(new PropertiesCommand(mainWindow, selection)); }
public override void Build(IMainWindow mainWindow, SelectedItemCollection selection, ContextMenuItemCollection items) { items.AddIfEnabled(new NewFolderCommand(mainWindow, selection)); items.AddIfEnabled(new PutFolderIntoRenameModeCommand(mainWindow, selection)); items.AddIfEnabled(new DeleteFolderCommand(mainWindow, selection)); items.AddPluginItems(PluginContextMenu.folder, selection); }
private void LifeCycleButton_MouseClick(object sender, EventArgs e) { if (droppedDown) { LifeCycleMenuStrip.Hide(); return; } if (source == null) { return; } Host host = source.Connection.Resolve<Host>(source.resident_on); if (host == null) { return; } ContextMenuItemCollection contextMenuItems = new ContextMenuItemCollection(); if (source.IsControlDomainZero) { // We're looking at the host console if (host.Connection.IsConnected) { contextMenuItems.Add(new ShutDownHostCommand(Program.MainWindow, host, this)); contextMenuItems.Add(new RebootHostCommand(Program.MainWindow, host, this)); } } else { contextMenuItems.AddIfEnabled(new ShutDownVMCommand(Program.MainWindow, source, this)); contextMenuItems.AddIfEnabled(new RebootVMCommand(Program.MainWindow, source, this)); contextMenuItems.AddIfEnabled(new SuspendVMCommand(Program.MainWindow, source, this)); contextMenuItems.AddIfEnabled(new InstallToolsCommand(Program.MainWindow, source, this)); contextMenuItems.AddIfEnabled(new ForceVMShutDownCommand(Program.MainWindow, source, this)); contextMenuItems.AddIfEnabled(new ForceVMRebootCommand(Program.MainWindow, source, this)); } LifeCycleMenuStrip.Items.Clear(); LifeCycleMenuStrip.Items.AddRange(contextMenuItems.ToArray()); LifeCycleMenuStrip.Show(pictureBox1, pictureBox1.Left, pictureBox1.Bottom); }