/// <summary> /// Configure ourself to be a menu relevant to the given Project with the /// given selected treeview nodes. /// </summary> public void Configure(ArrayList nodes, Project inProject) { base.Items.Clear(); project = inProject; MergableMenu menu = new MergableMenu(); foreach (GenericNode node in nodes) { MergableMenu newMenu = new MergableMenu(); AddItems(newMenu, node); menu = (menu.Count > 0) ? menu.Combine(newMenu) : newMenu; } menu.Apply(this.Items); // deal with special menu items that can't be applied to multiple paths bool singleFile = (nodes.Count == 1); AddMenu.Enabled = singleFile; Rename.Enabled = singleFile; Insert.Enabled = singleFile; Paste.Enabled = singleFile; RemoveSourcePath.CheckOnClick = false; RemoveSourcePath.Checked = true; // deal with naming the "Hide" button correctly if (nodes.Count > 1 || nodes.Count == 0) { HideItem.Text = TextHelper.GetString("Label.HideItems"); } else { HideItem.Text = (nodes[0] is DirectoryNode) ? TextHelper.GetString("Label.HideFolder") : TextHelper.GetString("Label.HideFile"); } // deal with shortcuts AssignShortcuts(); if (this.Items.Contains(AddMenu) && AddMenu.Enabled) { BuildAddMenu(); } if (base.Items.Count == 0) { base.Items.Add(NothingToDo); } }
/// <summary> /// Configure ourself to be a menu relevant to the given Project with the /// given selected treeview nodes. /// </summary> public void Configure(ArrayList nodes) { base.Items.Clear(); MergableMenu menu = new MergableMenu(); foreach (GenericNode node in nodes) { MergableMenu newMenu = new MergableMenu(); AddItems(newMenu, node); menu = (menu.Count > 0) ? menu.Combine(newMenu) : newMenu; } menu.Apply(this.Items); // deal with special menu items that can't be applied to multiple paths bool singleFile = (nodes.Count == 1); AddMenu.IsEnabled = singleFile; Rename.IsEnabled = singleFile; Insert.IsEnabled = singleFile; Paste.IsEnabled = singleFile; // deal with naming the "Hide" button correctly if (nodes.Count > 1 || nodes.Count == 0) { Hide.Text = "&Hide Items"; } else { Hide.Text = (nodes[0] is DirectoryNode) ? "&Hide Folder" : "&Hide File"; } // deal with shortcuts AssignShortcuts(); if (base.Items.Count == 0) { base.Items.Add(NothingToDo); } }
/// <summary> /// Configure ourself to be a menu relevant to the given Project with the /// given selected treeview nodes. /// </summary> public void Configure(ArrayList nodes) { base.Items.Clear(); MergableMenu menu = new MergableMenu(); foreach (GenericNode node in nodes) { MergableMenu newMenu = new MergableMenu(); AddItems(newMenu, node); menu = (menu.Count > 0) ? menu.Combine(newMenu) : newMenu; } menu.Apply(this.Items); // deal with special menu items that can't be applied to multiple paths bool singleFile = (nodes.Count == 1); AddMenu.Enabled = singleFile; Rename.Enabled = singleFile; Insert.Enabled = singleFile; Paste.Enabled = singleFile; // deal with naming the "Hide" button correctly if (nodes.Count > 1 || nodes.Count == 0) HideItem.Text = TextHelper.GetString("Label.HideItems"); else HideItem.Text = (nodes[0] is DirectoryNode) ? TextHelper.GetString("Label.HideFolder") : TextHelper.GetString("Label.HideFile"); // deal with shortcuts AssignShortcuts(); if (this.Items.Contains(AddMenu) && AddMenu.Enabled) BuildAddMenu(); if (base.Items.Count == 0) base.Items.Add(NothingToDo); }