|
|
|
|
@ -89,13 +89,8 @@ namespace ICSharpCode.SharpDevelop.Refactoring
@@ -89,13 +89,8 @@ namespace ICSharpCode.SharpDevelop.Refactoring
|
|
|
|
|
void AddTopLevelItems(List<object> resultItems, ITextEditor textEditor, ExpressionResult expressionResult, List<string> definitions, bool addAsSubmenu) |
|
|
|
|
{ |
|
|
|
|
// Insert items at this position to get the outermost expression first, followed by the inner expressions (if any).
|
|
|
|
|
int insertIndex = resultItems.Count; |
|
|
|
|
int insertIndex = resultItems.Count; |
|
|
|
|
ResolveResult rr = ResolveExpressionAtCaret(textEditor, expressionResult); |
|
|
|
|
RefactoringMenuContext context = new RefactoringMenuContext { |
|
|
|
|
Editor = textEditor, |
|
|
|
|
ResolveResult = rr, |
|
|
|
|
ExpressionResult = expressionResult |
|
|
|
|
}; |
|
|
|
|
MenuItem item = null; |
|
|
|
|
|
|
|
|
|
if (rr is MethodGroupResolveResult) { |
|
|
|
|
@ -116,8 +111,12 @@ namespace ICSharpCode.SharpDevelop.Refactoring
@@ -116,8 +111,12 @@ namespace ICSharpCode.SharpDevelop.Refactoring
|
|
|
|
|
} else if (rr is TypeResolveResult) { |
|
|
|
|
item = MakeItem(definitions, ((TypeResolveResult)rr).ResolvedClass); |
|
|
|
|
} else if (rr is LocalResolveResult) { |
|
|
|
|
int caretLine = textEditor.Caret.Line; |
|
|
|
|
context.IsDefinition = caretLine == ((LocalResolveResult)rr).VariableDefinitionRegion.BeginLine; |
|
|
|
|
bool isDefinition = textEditor.Caret.Line == ((LocalResolveResult)rr).VariableDefinitionRegion.BeginLine; |
|
|
|
|
ParseInformation pi = ParserService.GetParseInformation(textEditor.FileName); |
|
|
|
|
IProjectContent pc = null; |
|
|
|
|
if (pi != null) |
|
|
|
|
pc = pi.CompilationUnit.ProjectContent; |
|
|
|
|
RefactoringMenuContext context = new RefactoringMenuContext(textEditor, expressionResult, rr, isDefinition, pc); |
|
|
|
|
item = MakeItem((LocalResolveResult)rr, context); |
|
|
|
|
insertIndex = 0; // Insert local variable menu item at the topmost position.
|
|
|
|
|
} |
|
|
|
|
@ -183,9 +182,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
@@ -183,9 +182,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
|
|
|
|
|
{ |
|
|
|
|
Debug.Assert(local == context.ResolveResult); |
|
|
|
|
MenuItem item = MakeItemWithGoToDefinition(local.VariableName, |
|
|
|
|
local.IsParameter ? ClassBrowserIconService.Parameter : ClassBrowserIconService.LocalVariable, |
|
|
|
|
local.CallingClass.CompilationUnit, |
|
|
|
|
context.IsDefinition ? DomRegion.Empty : local.VariableDefinitionRegion); |
|
|
|
|
local.IsParameter ? ClassBrowserIconService.Parameter : ClassBrowserIconService.LocalVariable, |
|
|
|
|
local.CallingClass.CompilationUnit, |
|
|
|
|
context.IsDefinition ? DomRegion.Empty : local.VariableDefinitionRegion); |
|
|
|
|
string treePath = "/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/"; |
|
|
|
|
treePath += local.IsParameter ? "Parameter" : "LocalVariable"; |
|
|
|
|
if (context.IsDefinition) treePath += "Definition"; |
|
|
|
|
|