Skip to content

Instantly share code, notes, and snippets.

@bratsche
Created April 20, 2015 16:00
Show Gist options
  • Save bratsche/f0867ab01dc82e4a7c9e to your computer and use it in GitHub Desktop.
Save bratsche/f0867ab01dc82e4a7c9e to your computer and use it in GitHub Desktop.
void HandleSearchEntryActivated (object sender, EventArgs e)
{
var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
if (pattern.Pattern == null && pattern.LineNumber > 0) {
DestroyPopup ();
var doc = IdeApp.Workbench.ActiveDocument;
if (doc != null && doc.Editor != null) {
doc.Select ();
doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1);
doc.Editor.CenterToCaret ();
doc.Editor.Parent.StartCaretPulseAnimation ();
}
return;
}
if (popup != null) {
// XXX - this may not be the most appropriate place for this, but it seems to work...
var win = IdeApp.Workbench.RootWindow;
var nswindow = MonoDevelop.Components.Mac.GtkMacInterop.GetNSWindow (win);
nswindow.MakeFirstResponder (nswindow.ContentView);
popup.OpenFile ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment