diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-05-13 18:13:14 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-05-13 18:13:14 +0400 |
commit | 2f98c62ed47cf698d2f400218e917800779b7efc (patch) | |
tree | d0de870121ebfd37311a64dadbfd054d6c94801f /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs | |
parent | f7535734fe38c4d1997f0dc78b19a921edcac763 (diff) |
* MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs:
If a folder can't be deleted, show the error and just remove it from
the project. Added support for 'apply to all' in the confirmation
dialog.
svn path=/trunk/monodevelop/; revision=157306
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs index 4d2aaf2719..1101d74cf5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs @@ -173,20 +173,40 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void DeleteMultipleItems () { Set<SolutionEntityItem> projects = new Set<SolutionEntityItem> (); + + ConfirmationMessage confirmMsg = new ConfirmationMessage (); + confirmMsg.ConfirmButton = AlertButton.Delete; + confirmMsg.AllowApplyToAll = CurrentNodes.Length > 1; + foreach (ITreeNavigator node in CurrentNodes) { ProjectFolder folder = (ProjectFolder) node.DataItem as ProjectFolder; Project project = folder.Project; ProjectFile[] files = project != null ? project.Files.GetFilesInPath (folder.Path) : null; if (files != null && files.Length == 0) { - bool yes = MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to permanently delete the folder {0}?", folder.Path), AlertButton.Delete); + confirmMsg.Text = GettextCatalog.GetString ("Are you sure you want to permanently delete the folder {0}?", folder.Path); + bool yes = MessageService.Confirm (confirmMsg); if (!yes) return; + bool removeFiles = false; try { - FileService.DeleteDirectory (folder.Path); - } catch { - MessageService.ShowError (GettextCatalog.GetString ("The folder {0} could not be deleted", folder.Path)); + if (Directory.Exists (folder.Path)) + // Indirect events will remove the files from the project + FileService.DeleteDirectory (folder.Path); + else + removeFiles = true; + } catch (Exception ex) { + MessageService.ShowError (GettextCatalog.GetString ("The folder {0} could not be deleted from disk: {1}", folder.Path, ex.Message)); + removeFiles = true; + } + if (removeFiles && project != null) { + List<ProjectFile> list = new List<ProjectFile>(); + list.AddRange (project.Files.GetFilesInVirtualPath (folder.Path.ToRelative (project.BaseDirectory))); + ProjectFile pf = project.Files.GetFileWithVirtualPath (folder.Path.ToRelative (project.BaseDirectory)); + if (pf != null) list.Add (pf); + foreach (var f in list) + project.Files.Remove (f); } } else { |