private int AddDropDownBar()
        {
            var pythonProjectEntry = _textView.TextBuffer.GetAnalysis() as IPythonProjectEntry;

            if (pythonProjectEntry == null)
            {
                return(VSConstants.E_FAIL);
            }

            DropDownBarClient dropDown = _client = new DropDownBarClient(_textView, pythonProjectEntry);

            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);
        }
Example #2
0
        private int AddDropDownBar() {
            var pythonProjectEntry = _textView.TextBuffer.GetAnalysis() as IPythonProjectEntry;
            if (pythonProjectEntry == null) {
                return VSConstants.E_FAIL;
            }

            DropDownBarClient dropDown = _client = new DropDownBarClient(_textView, pythonProjectEntry);

            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;
        }
 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);
 }
Example #4
0
 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;
 }