diff --git a/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.addin b/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.addin
index d8494edc37..678ef91edb 100644
--- a/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.addin
+++ b/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.addin
@@ -42,6 +42,7 @@
+
diff --git a/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.csproj b/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.csproj
index 24cc7ab926..d052e1665e 100644
--- a/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.csproj
+++ b/src/AddIns/Misc/SharpRefactoring/Project/SharpRefactoring.csproj
@@ -81,6 +81,7 @@
+
diff --git a/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementAbstractClass.cs b/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementAbstractClass.cs
index dff5a8e69d..c670ffcdc6 100644
--- a/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementAbstractClass.cs
+++ b/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementAbstractClass.cs
@@ -23,8 +23,6 @@ namespace SharpRefactoring.ContextActions
{
public override IEnumerable GetAvailableActions(EditorContext editorContext)
{
- var ambience = AmbienceService.GetCurrentAmbience();
-
foreach (var targetClass in editorContext.GetClassDeclarationsOnCurrentLine().Where(c => c.ClassType == ClassType.Class)) {
foreach (var implementAction in RefactoringService.GetImplementAbstractClassActions(targetClass)) {
diff --git a/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterface.cs b/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterface.cs
index 059c126b8b..5b4407c62d 100644
--- a/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterface.cs
+++ b/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterface.cs
@@ -29,8 +29,6 @@ namespace SharpRefactoring.ContextActions
// Using CurrentLineAST is basically OK, but when the "class" keyword is on different line than class name,
// parsing only one line never tells us that we are looking at TypeDeclaration
// Alternative solution could be to try to resolve also IdentifierExpression to see if it is class declaration.
- var ambience = AmbienceService.GetCurrentAmbience();
-
foreach (var targetClass in editorContext.GetClassDeclarationsOnCurrentLine().
Where(c => c.ClassType == ClassType.Class || c.ClassType == ClassType.Interface)) {
diff --git a/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterfaceExplicit.cs b/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterfaceExplicit.cs
new file mode 100644
index 0000000000..bc202f3d77
--- /dev/null
+++ b/src/AddIns/Misc/SharpRefactoring/Project/Src/ContextActions/ImplementInterfaceExplicit.cs
@@ -0,0 +1,38 @@
+//
+//
+//
+//
+// $Revision: $
+//
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+using ICSharpCode.NRefactory;
+using Ast = ICSharpCode.NRefactory.Ast;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
+using ICSharpCode.SharpDevelop.Editor;
+using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
+using ICSharpCode.SharpDevelop.Refactoring;
+
+namespace SharpRefactoring.ContextActions
+{
+ ///
+ /// Description of ImplementInterface.
+ ///
+ public class ImplementInterfaceExplicitProvider : ContextActionsProvider
+ {
+ public override IEnumerable GetAvailableActions(EditorContext editorContext)
+ {
+ foreach (var targetClass in editorContext.GetClassDeclarationsOnCurrentLine().
+ Where(c => c.ClassType == ClassType.Class || c.ClassType == ClassType.Interface)) {
+
+ foreach (var implementAction in RefactoringService.GetImplementInterfaceActions(targetClass, true)) {
+ yield return implementAction;
+ }
+ }
+ }
+ }
+}
diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs
index e40cd8ba2d..e5d6a20d7f 100644
--- a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs
+++ b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs
@@ -36,7 +36,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring
this.providers = AddInTree.BuildItems("/SharpDevelop/ViewContent/AvalonEdit/ContextActions", null, false);
var disabledActions = LoadProviderVisibilities().ToLookup(s => s);
foreach (var provider in providers) {
- // load from configuration
provider.IsVisible = !disabledActions.Contains(provider.GetType().FullName);
}
}
diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
index 517e518934..ad14c1dbb0 100644
--- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
+++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
@@ -477,23 +477,29 @@ namespace ICSharpCode.SharpDevelop.Refactoring
///
/// Gets actions which can add implementation of interface to given class.
///
- public static IEnumerable GetImplementInterfaceActions(IClass c, bool returnMissingInterfacesOnly = true)
+ public static IEnumerable GetImplementInterfaceActions(IClass c, bool isExplicit = false, bool returnMissingInterfacesOnly = true)
{
var interfacesToImplement = GetInterfacesToImplement(c, returnMissingInterfacesOnly).ToList();
- if (c.ProjectContent.Language.SupportsImplicitInterfaceImplementation) {
- return MakeImplementActions(c, interfacesToImplement, false, "Implement interface {0}").Concat(
- MakeImplementActions(c, interfacesToImplement, true, "Implement interface {0} (explicit)"));
+ if (!isExplicit) {
+ if (c.ProjectContent.Language.SupportsImplicitInterfaceImplementation) {
+ return MakeImplementActions(c, interfacesToImplement, false, "Implement interface {0}");
+ } else
+ return new ImplementInterfaceAction[0];
} else {
- return MakeImplementActions(c, interfacesToImplement, true, "Implement interface {0}");
+ if (c.ProjectContent.Language.SupportsImplicitInterfaceImplementation) {
+ return MakeImplementActions(c, interfacesToImplement, true, "Implement interface {0} (explicit)");
+ } else {
+ return MakeImplementActions(c, interfacesToImplement, true, "Implement interface {0}");
+ }
}
}
- static IEnumerable MakeImplementActions(IClass c, IEnumerable interfaces, bool isExplit, string format)
+ static IEnumerable MakeImplementActions(IClass c, IEnumerable interfaces, bool isExplicit, string format)
{
var ambience = AmbienceService.GetCurrentAmbience();
foreach (var iface in interfaces) {
- yield return new ImplementInterfaceAction(iface, c, isExplit) {
+ yield return new ImplementInterfaceAction(iface, c, isExplicit) {
Title = string.Format(format, ambience.Convert(iface))
};
}
@@ -527,7 +533,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
continue;
}
IReturnType rtCopy = rt;
- yield return new ImplementAbstractClassAction(rtCopy, c) {
+ yield return new ImplementAbstractClassAction(rtCopy, c) {
Title = string.Format("Implement abstract class {0}", ambience.Convert(rtCopy)) };
}
}