|
|
|
@ -6,6 +6,7 @@
@@ -6,6 +6,7 @@
|
|
|
|
|
// </file>
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using ICSharpCode.SharpDevelop.Dom; |
|
|
|
|
using ICSharpCode.SharpDevelop.Editor; |
|
|
|
|
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; |
|
|
|
|
using ICSharpCode.SharpDevelop.Refactoring; |
|
|
|
@ -19,11 +20,32 @@ namespace SharpRefactoring.ContextActions
@@ -19,11 +20,32 @@ namespace SharpRefactoring.ContextActions
|
|
|
|
|
{ |
|
|
|
|
public IEnumerable<IContextAction> GetAvailableActions(EditorASTProvider editorAST) |
|
|
|
|
{ |
|
|
|
|
yield break; |
|
|
|
|
var currentLineAST = editorAST.CurrentLineAST; |
|
|
|
|
if (currentLineAST == null) |
|
|
|
|
yield break; |
|
|
|
|
var symbol = editorAST.SymbolUnderCaret; |
|
|
|
|
foreach (var contextAction in GetAddUsingContextActions(symbol, editorAST.Editor)) { |
|
|
|
|
yield return contextAction; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IEnumerable<IContextAction> GetAddUsingContextActions(ResolveResult symbol, ITextEditor editor) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<RefactoringService.AddUsingAction> addUsingActions = null; |
|
|
|
|
if (symbol is UnknownIdentifierResolveResult) { |
|
|
|
|
addUsingActions = RefactoringService.GetAddUsingActions((UnknownIdentifierResolveResult)symbol, editor); |
|
|
|
|
} else if (symbol is UnknownConstructorCallResolveResult) { |
|
|
|
|
addUsingActions = RefactoringService.GetAddUsingActions((UnknownConstructorCallResolveResult)symbol, editor); |
|
|
|
|
} |
|
|
|
|
if (addUsingActions == null) |
|
|
|
|
yield break; |
|
|
|
|
foreach (var addUsingAction in addUsingActions) { |
|
|
|
|
var addUsingActionCopy = addUsingAction; |
|
|
|
|
yield return new DelegateAction { |
|
|
|
|
Title = "using " + addUsingActionCopy.NewNamespace, |
|
|
|
|
ExecuteAction = addUsingActionCopy.Execute |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public class AddUsingAction |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|