/// <summary> /// Handles the DoubleClick event of the lstConflictView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void lstConflictView_DoubleClick(object sender, EventArgs e) { if (lstConflictView.SelectedItems != null && lstConflictView.SelectedItems.Count > 0) { foreach (CodeElement codeElement in codeElements) { if (codeElement.Name == lstConflictView.SelectedItems[0].SubItems[1].Text) { EditorSupport.GoToCodeElementHelper(codeElement.DTE, codeElement, false); break; } } } }
public void TestMethodAutoCompleteMatchWeight() { Assert.AreEqual(10000, EditorSupport.CalculateMatchingWeight("a", "a")); Assert.AreEqual(30000, EditorSupport.CalculateMatchingWeight("abc", "abc")); Assert.AreEqual(30000, EditorSupport.CalculateMatchingWeight("ABC", "ABC")); Assert.AreEqual(30000 - 100, EditorSupport.CalculateMatchingWeight("bcd", "abcde")); Assert.AreEqual(30000 - 200, EditorSupport.CalculateMatchingWeight("cde", "abcde")); Assert.AreEqual(30000 - 100 - 5, EditorSupport.CalculateMatchingWeight("Bcd", "abcde")); Assert.AreEqual(30000 - 200 - 10, EditorSupport.CalculateMatchingWeight("CDe", "abcde")); Assert.AreEqual(0, EditorSupport.CalculateMatchingWeight("bce", "abcde")); Assert.AreEqual(0, EditorSupport.CalculateMatchingWeight("ebc", "abcde")); }
/// <summary> /// Navigates from the selected node in the tree to its code /// element in the editor window, and gives the editor focus. /// </summary> private void NavigateToSelectedTreeNode() { var codeElement = _control.VisibleTreeView.SelectedNode as CodeElementWrapper; // This can happen if there were no matching code elements. if (codeElement == null) { return; } // Switch to the code window. _editSupport = new EditorSupport(); _editSupport.ActivateCodeWindow(codeElement, Dte); }
/// <summary> /// Occurs when the tree view control is entered. /// </summary> /// <param name="sender">The source TreeView object for this event.</param> /// <param name="e">The EventArgs object that contains the event data.</param> private void codeTreeView_Enter(object sender, EventArgs e) { try { // Make sure the selected element in the outline window is also selected in the text window. var codeElement = _control.VisibleTreeView.SelectedNode as CodeElementWrapper; _editSupport = new EditorSupport(); _editSupport.GoToCodeElement(codeElement, Dte); } catch (Exception ex) { Utils.DisplayMessage(Resources.ErrorPrefix, "codeTreeView_Enter exception: " + ex); } }
/// <summary> /// Occurs when the tree view control is double-clicked. /// </summary> /// <param name="sender">The source TreeView object for this event.</param> /// <param name="e">The EventArgs object that contains the event data.</param> private void codeTreeView_DoubleClick(object sender, EventArgs e) { try { var codeElement = _control.VisibleTreeView.SelectedNode as CodeElementWrapper; // This can happen if there were no matching code elements. if (codeElement == null) { return; } _editSupport = new EditorSupport(); _editSupport.ActivateCodeWindow(codeElement, Dte); } catch (Exception ex) { Utils.DisplayMessage(Resources.ErrorPrefix, "codeTreeView_DoubleClick exception: " + ex); } }
/// <summary> /// Occurs after the tree node is selected. /// </summary> /// <param name="sender">The source TreeView object for this event.</param> /// <param name="e">The TreeViewEventArgs object that contains the event data.</param> private void codeTreeView_AfterSelect(object sender, TreeViewEventArgs e) { try { if ((e.Action == TreeViewAction.ByKeyboard) || (e.Action == TreeViewAction.ByMouse)) { var codeElement = e.Node as CodeElementWrapper; _editSupport = new EditorSupport(); _editSupport.GoToCodeElement(codeElement, Dte); } } catch (Exception ex) { Utils.DisplayMessage(Resources.ErrorPrefix, "codeTreeView_AfterSelect exception: " + ex); } }