Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/addins/AspNet/Commands/AddViewFromControllerCommandHandler.cs')
-rw-r--r--main/src/addins/AspNet/Commands/AddViewFromControllerCommandHandler.cs12
1 files changed, 4 insertions, 8 deletions
diff --git a/main/src/addins/AspNet/Commands/AddViewFromControllerCommandHandler.cs b/main/src/addins/AspNet/Commands/AddViewFromControllerCommandHandler.cs
index 0d732c6f54..ed0bd44867 100644
--- a/main/src/addins/AspNet/Commands/AddViewFromControllerCommandHandler.cs
+++ b/main/src/addins/AspNet/Commands/AddViewFromControllerCommandHandler.cs
@@ -43,16 +43,12 @@ namespace MonoDevelop.AspNet.Commands
{
var doc = IdeApp.Workbench.ActiveDocument;
var project = (DotNetProject)doc.Project;
- var currentLocation = doc.Editor.Caret.Location;
- string controllerName = doc.ParsedDocument.GetTopLevelTypeDefinition (currentLocation).Name;
- int pos = controllerName.LastIndexOf ("Controller", StringComparison.Ordinal);
- if (pos > 0)
- controllerName = controllerName.Remove (pos);
+ var method = MethodDeclarationAtCaret.Create (doc);
+ string controllerName = method.GetParentMvcControllerName ();
+ string path = doc.FileName.ParentDirectory.ParentDirectory.Combine ("Views", controllerName);
- string path = doc.FileName.ParentDirectory.ParentDirectory.Combine ("Views", controllerName);
- string actionName = doc.ParsedDocument.GetMember (currentLocation).Name;
- AddView (project, path, actionName);
+ AddView (project, path, method.Name);
}
public static void AddView (DotNetProject project, string path, string name)