public override void SelectOccurrence(AnalysisOccurrence target)
{
if (target == null)
{
TryHideFocusBoxAndUninstall();
return;
}
if (SelectedOccurrence == target && IsFocusBoxInstalled)
{
// Don't steal the focus from another window. See FWR-1795.
if (ParentForm == Form.ActiveForm)
{
if (ExistingFocusBox.CanFocus)
{
ExistingFocusBox.Focus(); // important when switching tabs with ctrl-tab.
}
else
{
VisibleChanged += FocusWhenVisible;
}
}
return;
}
if (!m_vc.CanBeAnalyzed(target))
return;
#if DEBUG
// test preconditions.
Debug.Assert(target.IsValid && !(target.Analysis is IPunctuationForm), "Given annotation type should not be punctuation"
+ " but was " + target.Analysis.ShortName + ".");
#endif
TriggerAnnotationSelected(target, true);
}