public void Execute(IActionContext context) { IResourceList selected = context.SelectedResources; ArrayList names = new ArrayList(selected.Count); foreach (IResource res in selected.ValidResources) { string name = res.GetStringProp(FileProxy._propDirectory); if (res.Type != FileProxy._folderResourceType) { name = Path.Combine(name, res.GetPropText(Core.Props.Name)); } names.Add(name); } if (names.Count > 0) { IResourceBrowser rBrowser = Core.ResourceBrowser; IResourceList viewedResources = selected.Intersect(rBrowser.SelectedResources); IResource res2Select = null; foreach (IResource res in viewedResources.ValidResources) { res2Select = rBrowser.GetResourceBelow(res); } try { FoldersCollection foldersCollection = FoldersCollection.Instance; if (Control.ModifierKeys == Keys.Shift) { if (MessageBox.Show(Core.MainWindow, "Are you sure you want to delete " + ((names.Count > 1) ? (names.Count + " selected items?") : ("'" + names[0] + "'?")), "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { foreach (IResource res in selected.ValidResources) { foldersCollection.DeleteResource(res); } foreach (string name in names) { if (File.Exists(name)) { File.Delete(name); } else if (Directory.Exists(name)) { Directory.Delete(name, true); } } } } else { Shell32.MoveFile2RecycleBin((string[])names.ToArray(typeof(string))); FileProxy._filesProcessor.QueueJob( new ResourceListDelegate(foldersCollection.EnumerateParents), selected); } } catch (Exception e) { Utils.DisplayException(e, "Error"); return; } if (res2Select != null) { rBrowser.SelectResource(res2Select); } } }