diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs index 21aba0b470..27946ee746 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs @@ -83,7 +83,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildChildNodes (ITreeBuilder ctx, object dataObject) { SolutionFolder folder = (SolutionFolder) dataObject; - foreach (SolutionItem entry in folder.Items) + foreach (SolutionFolderItem entry in folder.Items) ctx.AddChild (entry); foreach (FilePath file in folder.Files) ctx.AddChild (new SolutionFolderFileNode (file, folder)); @@ -178,7 +178,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad CurrentNode.Expanded = !CurrentNode.Expanded; } - public override void RenameItem (string newName) + public async override void RenameItem (string newName) { if (newName.IndexOfAny (new char [] { '\'', '(', ')', '"', '{', '}', '|' } ) != -1) { MessageService.ShowError (GettextCatalog.GetString ("Solution name may not contain any of the following characters: {0}", "', (, ), \", {, }, |")); @@ -187,7 +187,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; folder.Name = newName; - IdeApp.Workspace.Save(); + await IdeApp.Workspace.SaveAsync(); } public override DragOperation CanDragNode () @@ -199,15 +199,15 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { if (dataObject is IFileItem) return true; - SolutionItem it = dataObject as SolutionItem; + SolutionFolderItem it = dataObject as SolutionFolderItem; return it != null && operation == DragOperation.Move; } - public override void OnNodeDrop (object dataObject, DragOperation operation) + public async override void OnNodeDrop (object dataObject, DragOperation operation) { SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; - if (dataObject is SolutionItem) { - SolutionItem it = (SolutionItem) dataObject; + if (dataObject is SolutionFolderItem) { + SolutionFolderItem it = (SolutionFolderItem) dataObject; if (!MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to move the item '{0}' to the solution folder '{1}'?", it.Name, folder.Name), AlertButton.Move)) return; @@ -218,7 +218,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad DropFile (folder, (IFileItem) dataObject, operation); } - IdeApp.ProjectOperations.Save (folder.ParentSolution); + await IdeApp.ProjectOperations.SaveAsync (folder.ParentSolution); } internal static void DropFile (SolutionFolder folder, IFileItem fileItem, DragOperation operation) @@ -250,7 +250,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad IdeApp.ProjectOperations.ShowOptions (folder); } - public override void DeleteItem () + public async override void DeleteItem () { SolutionFolder folder = CurrentNode.DataItem as SolutionFolder; SolutionFolder parent = folder.ParentFolder; @@ -261,7 +261,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad Solution sol = folder.ParentSolution; parent.Items.Remove (folder); folder.Dispose (); - IdeApp.ProjectOperations.Save (sol); + await IdeApp.ProjectOperations.SaveAsync (sol); } } @@ -269,7 +269,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public void AddNewProjectToSolutionFolder() { SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; - SolutionItem ce = IdeApp.ProjectOperations.CreateProject (folder); + SolutionFolderItem ce = IdeApp.ProjectOperations.CreateProject (folder); if (ce == null) return; Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); CurrentNode.Expanded = true; @@ -279,10 +279,11 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public void AddProjectToSolutionFolder() { SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; - SolutionItem ce = IdeApp.ProjectOperations.AddSolutionItem (folder); - if (ce == null) return; - Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); - CurrentNode.Expanded = true; + IdeApp.ProjectOperations.AddSolutionItem (folder).ContinueWith (t => { + if (t.Result == null) return; + Tree.AddNodeInsertCallback (t.Result, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + }); } [CommandHandler (ProjectCommands.AddSolutionFolder)] @@ -300,7 +301,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad [AllowMultiSelection] public void OnReload () { - using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) { + using (ProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) { m.BeginTask (null, CurrentNodes.Length); foreach (ITreeNavigator node in CurrentNodes) { SolutionFolder folder = (SolutionFolder) node.DataItem; @@ -334,12 +335,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad }*/ [CommandHandler (ProjectCommands.AddFiles)] - protected void OnAddFiles () + protected async void OnAddFiles () { SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; if (IdeApp.ProjectOperations.AddFilesToSolutionFolder (folder)) { CurrentNode.Expanded = true; - IdeApp.ProjectOperations.Save (folder.ParentSolution); + await IdeApp.ProjectOperations.SaveAsync (folder.ParentSolution); } } |