diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2015-08-26 18:57:29 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2015-08-26 18:57:47 +0300 |
commit | 4efdafdcc6e407c91c92798428954de6718e72d8 (patch) | |
tree | 7126003cfbefeff2d690356ef13eb02d4c486417 /main/src/core/MonoDevelop.Ide | |
parent | 46741fd8598b8b5f1baae021fc06fb60c8f6c1d4 (diff) |
[Ide] Don't allow dropping files into other files
It is a very unusual operation which is very easy to trigger and which
is a source of confusion to users.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs index ca2204543b..57608e02bb 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs @@ -224,60 +224,6 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad return DragOperation.Copy | DragOperation.Move; } - public override bool CanDropNode (object dataObject, DragOperation operation) - { - var target = (ProjectFile) CurrentNode.DataItem; - var pf = dataObject as ProjectFile; - - return pf != null && pf != target && !pf.HasChildren && target.DependsOn == null; - } - - void Drop (ProjectFile pf, DragOperation operation, HashSet<SolutionEntityItem> projectsToSave) - { - var target = (ProjectFile) CurrentNode.DataItem; - var targetDirectory = target.FilePath.ParentDirectory; - - // file dependencies only work if they are in the same physical folder - if (pf.FilePath.ParentDirectory != targetDirectory) { - var targetPath = targetDirectory.Combine (pf.FilePath.FileName); - - // if copying to the same directory, make a copy with a different name - if (targetPath == pf.FilePath) - targetPath = ProjectOperations.GetTargetCopyName (targetPath, false); - - if (File.Exists (targetPath)) - if (!MessageService.Confirm (GettextCatalog.GetString ("The file '{0}' already exists. Do you want to overwrite it?", targetPath.FileName), AlertButton.OverwriteFile)) - return; - - // unlink the project file from its current parent - pf.DependsOn = null; - - projectsToSave.Add (pf.Project); - - bool move = operation == DragOperation.Move; - var opText = move ? GettextCatalog.GetString ("Moving file...") : GettextCatalog.GetString ("Copying file..."); - - using (var monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (opText, Stock.StatusWorking, true)) - IdeApp.ProjectOperations.TransferFiles (monitor, pf.Project, pf.FilePath, target.Project, targetPath, move, true); - - pf = target.Project.Files.GetFile (targetPath); - } - - // the dropped project file now depends on the file it was just dropped onto - pf.DependsOn = target.FilePath.FileName; - projectsToSave.Add (pf.Project); - } - - public override void OnMultipleNodeDrop (object[] dataObjects, DragOperation operation) - { - var projectsToSave = new HashSet<SolutionEntityItem> (); - - foreach (var dataObject in dataObjects) - Drop ((ProjectFile) dataObject, operation, projectsToSave); - - IdeApp.ProjectOperations.Save (projectsToSave); - } - public override bool CanDeleteItem () { return true; |