private int RemoveDropDownBar() { if (_client != null) { IVsDropdownBarManager manager = (IVsDropdownBarManager)_window; _client.Unregister(); _client = null; _textView.TextBuffer.Properties.RemoveProperty(typeof(DropDownBarClient)); return manager.RemoveDropdownBar(); } return VSConstants.S_OK; }
private int AddDropDownBar() { var jProjectEntry = _textView.TextBuffer.GetAnalysis() as IJProjectEntry; if (jProjectEntry == null) { return VSConstants.E_FAIL; } DropDownBarClient dropDown = _client = new DropDownBarClient(_textView, jProjectEntry); IVsDropdownBarManager manager = (IVsDropdownBarManager)_window; IVsDropdownBar dropDownBar; int hr = manager.GetDropdownBar(out dropDownBar); if (ErrorHandler.Succeeded(hr) && dropDownBar != null) { hr = manager.RemoveDropdownBar(); if (!ErrorHandler.Succeeded(hr)) { return hr; } } int res = manager.AddDropdownBar(2, dropDown); if (ErrorHandler.Succeeded(res)) { _textView.TextBuffer.Properties[typeof(DropDownBarClient)] = dropDown; } return res; }