|
|
|
@ -115,30 +115,7 @@ namespace SearchAndReplace |
|
|
|
|
|
|
|
|
|
|
|
public override void ActivateItem() |
|
|
|
public override void ActivateItem() |
|
|
|
{ |
|
|
|
{ |
|
|
|
var location = anchor.Location; |
|
|
|
FileService.JumpToFilePosition(anchor.FileName, anchor.Location.Line, anchor.Location.Column); |
|
|
|
ITextEditorProvider provider = FileService.JumpToFilePosition(anchor.FileName, location.Line, location.Column) as ITextEditorProvider; |
|
|
|
|
|
|
|
if (provider != null) { |
|
|
|
|
|
|
|
ITextMarkerService markerService = provider.TextEditor.GetService(typeof(ITextMarkerService)) as ITextMarkerService; |
|
|
|
|
|
|
|
if (markerService != null) { |
|
|
|
|
|
|
|
ITextMarker marker = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
marker = markerService.Create(provider.TextEditor.Document.PositionToOffset(location.Line, location.Column), result.Length); |
|
|
|
|
|
|
|
} catch (ArgumentOutOfRangeException) { |
|
|
|
|
|
|
|
// can happen if lineNumber/column is after the end of the document; or if
|
|
|
|
|
|
|
|
// result.Length is too long
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (marker != null) { |
|
|
|
|
|
|
|
marker.BackgroundColor = Colors.Orange; |
|
|
|
|
|
|
|
marker.Tag = this; |
|
|
|
|
|
|
|
EventHandler remover = null; |
|
|
|
|
|
|
|
remover = (sender, e) => { |
|
|
|
|
|
|
|
marker.Delete(); |
|
|
|
|
|
|
|
provider.TextEditor.Caret.PositionChanged -= remover; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
provider.TextEditor.Caret.PositionChanged += remover; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|