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/MvcCommandsCommonHandler.cs')
-rw-r--r--main/src/addins/AspNet/Commands/MvcCommandsCommonHandler.cs13
1 files changed, 3 insertions, 10 deletions
diff --git a/main/src/addins/AspNet/Commands/MvcCommandsCommonHandler.cs b/main/src/addins/AspNet/Commands/MvcCommandsCommonHandler.cs
index efa6c6493c..8f8acfc539 100644
--- a/main/src/addins/AspNet/Commands/MvcCommandsCommonHandler.cs
+++ b/main/src/addins/AspNet/Commands/MvcCommandsCommonHandler.cs
@@ -26,7 +26,6 @@
using System;
using System.Linq;
-using ICSharpCode.NRefactory.TypeSystem;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide;
using MonoDevelop.AspNet.Projects;
@@ -48,17 +47,11 @@ namespace MonoDevelop.AspNet.Commands
return;
}
- var currentLocation = doc.Editor.Caret.Location;
- var topLevelType = doc.ParsedDocument.GetTopLevelTypeDefinition (currentLocation);
- if (topLevelType == null || !topLevelType.Name.EndsWith ("Controller", StringComparison.Ordinal)) {
- info.Enabled = info.Visible = false;
+ var method = MethodDeclarationAtCaret.Create (doc);
+ if (method.IsMethodFound && method.IsParentMvcController () && method.IsMvcViewMethod ())
return;
- }
- var correctReturnTypes = new [] { "ActionResult", "ViewResultBase", "ViewResult", "PartialViewResult" };
- var member = doc.ParsedDocument.GetMember (currentLocation) as IUnresolvedMethod;
- if (member == null || !member.IsPublic || correctReturnTypes.All (t => t != member.ReturnType.ToString ()))
- info.Enabled = info.Visible = false;
+ info.Enabled = info.Visible = false;
}
}
}