protected override bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            comboBoxCount = 2;
            client        = CreateDropdownBarClient();

            return(true);
        }
            private static IVsDropdownBarClient GetDropdownBarClient(IVsDropdownBar dropdownBar)
            {
                IVsDropdownBarClient dropdownBarClient = null;

                ErrorHandler.ThrowOnFailure(dropdownBar.GetClient(out dropdownBarClient));
                return(dropdownBarClient);
            }
Esempio n. 3
0
        protected virtual int AddDropdownBar(int comboBoxCount, IVsDropdownBarClient client)
        {
            Contract.Requires <ArgumentNullException>(client != null, "client");
            Contract.Requires <ArgumentOutOfRangeException>(comboBoxCount > 0);

            IVsDropdownBarManager manager = CodeWindow as IVsDropdownBarManager;

            if (manager == null)
            {
                throw new NotSupportedException();
            }

            IVsDropdownBar dropdownBar;
            int            hr = manager.GetDropdownBar(out dropdownBar);

            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                hr = manager.RemoveDropdownBar();
                if (ErrorHandler.Failed(hr))
                {
                    return(hr);
                }
            }

            return(manager.AddDropdownBar(comboBoxCount, client));
        }
Esempio n. 4
0
        protected virtual int RemoveDropdownBar()
        {
            IVsDropdownBarManager manager = CodeWindow as IVsDropdownBarManager;

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

            IVsDropdownBar dropdownBar;
            int            hr = manager.GetDropdownBar(out dropdownBar);

            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                IVsDropdownBarClient client;
                hr = dropdownBar.GetClient(out client);
                if (ErrorHandler.Succeeded(hr) && client == _dropdownBarClient)
                {
                    _dropdownBarClient = null;
                    return(manager.RemoveDropdownBar());
                }
            }

            _dropdownBarClient = null;
            return(VSConstants.S_OK);
        }
Esempio n. 5
0
        protected override bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            comboBoxCount = 2;
            client = CreateDropdownBarClient();

            return true;
        }
            private void AdddropdownBar(IVsDropdownBarManager dropdownManager)
            {
                IVsTextLines buffer;

                if (ErrorHandler.Failed(_codeWindow.GetBuffer(out buffer)))
                {
                    return;
                }

                var navigationBarClient      = new NavigationBarClient(dropdownManager, _codeWindow, _languageService.SystemServiceProvider, _languageService.Workspace);
                var textBuffer               = _languageService.EditorAdaptersFactoryService.GetDataBuffer(buffer);
                var controllerFactoryService = _languageService.Package.ComponentModel.GetService <INavigationBarControllerFactoryService>();
                var newController            = controllerFactoryService.CreateController(navigationBarClient, textBuffer);
                var hr = dropdownManager.AddDropdownBar(cCombos: 3, pClient: navigationBarClient);

                if (ErrorHandler.Failed(hr))
                {
                    newController.Disconnect();
                    ErrorHandler.ThrowOnFailure(hr);
                }

                _navigationBarController = newController;
                _dropdownBarClient       = navigationBarClient;
                return;
            }
Esempio n. 7
0
        protected virtual int AddDropdownBar(int comboBoxCount, [NotNull] IVsDropdownBarClient client)
        {
            Requires.NotNull(client, nameof(client));
            Requires.Range(comboBoxCount > 0, nameof(comboBoxCount));

            IVsDropdownBarManager manager = CodeWindow as IVsDropdownBarManager;

            if (manager == null)
            {
                throw new NotSupportedException();
            }

            IVsDropdownBar dropdownBar;
            int            hr = manager.GetDropdownBar(out dropdownBar);

            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                hr = manager.RemoveDropdownBar();
                if (ErrorHandler.Failed(hr))
                {
                    return(hr);
                }
            }

            return(manager.AddDropdownBar(comboBoxCount, client));
        }
        private int AddDropDownBar()
        {
            int comboBoxCount;
            IVsDropdownBarClient client;
            if (TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }

            return VSConstants.S_OK;
        }
Esempio n. 9
0
        private int AddDropDownBar()
        {
            int comboBoxCount;
            IVsDropdownBarClient client;

            if (TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }

            return(VSConstants.S_OK);
        }
            private void RemoveDropdownBar(IVsDropdownBarManager dropdownManager)
            {
                if (ErrorHandler.Succeeded(dropdownManager.RemoveDropdownBar()))
                {
                    if (_navigationBarController != null)
                    {
                        _navigationBarController.Disconnect();
                        _navigationBarController = null;
                    }

                    _dropdownBarClient = null;
                }
            }
Esempio n. 11
0
        private bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            var componentModel            = ServiceProvider.GetComponentModel();
            var editorAdaptersFactory     = componentModel.DefaultExportProvider.GetExportedValueOrDefault <IVsEditorAdaptersFactoryService>();
            var bufferGraphFactoryService = componentModel.DefaultExportProvider.GetExportedValue <IBufferGraphFactoryService>();

            var textView = editorAdaptersFactory.GetWpfTextView(CodeWindow.GetPrimaryView());

            var editorNavigationSourceProvider = componentModel.DefaultExportProvider.GetExportedValueOrDefault <EditorNavigationSourceProvider>();
            var editorNavigationSource         = editorNavigationSourceProvider.TryCreateEditorNavigationSource(textView.TextBuffer);

            comboBoxCount = 2;
            client        = new EditorNavigationDropdownBarClient(CodeWindow, editorAdaptersFactory, editorNavigationSource, bufferGraphFactoryService);

            return(true);
        }
Esempio n. 12
0
        protected virtual void HandleLanguagePreferencesChanged(object sender, [NotNull] EventArgs e)
        {
            Requires.NotNull(e, nameof(e));

            int comboBoxCount;
            IVsDropdownBarClient client;

            if (_dropdownBarClient == null && LanguagePreferences.ShowDropdownBar && TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }
            else if (_dropdownBarClient != null && !LanguagePreferences.ShowDropdownBar)
            {
                ErrorHandler.ThrowOnFailure(RemoveDropdownBar());
            }
        }
Esempio n. 13
0
        protected virtual void HandleLanguagePreferencesChanged(object sender, EventArgs e)
        {
            Contract.Requires <ArgumentNullException>(e != null, "e");

            int comboBoxCount;
            IVsDropdownBarClient client;

            if (_dropdownBarClient == null && LanguagePreferences.ShowDropdownBar && TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }
            else if (_dropdownBarClient != null && !LanguagePreferences.ShowDropdownBar)
            {
                ErrorHandler.ThrowOnFailure(RemoveDropdownBar());
            }
        }
Esempio n. 14
0
        public virtual int AddAdornments()
        {
            IVsTextView textView;
            if (ErrorHandler.Succeeded(CodeWindow.GetPrimaryView(out textView)) && textView != null)
                ErrorHandler.ThrowOnFailure(OnNewView(textView));
            if (ErrorHandler.Succeeded(CodeWindow.GetSecondaryView(out textView)) && textView != null)
                ErrorHandler.ThrowOnFailure(OnNewView(textView));

            int comboBoxCount;
            IVsDropdownBarClient client;
            if (LanguagePreferences.ShowDropdownBar && TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }

            return VSConstants.S_OK;
        }
Esempio n. 15
0
        protected virtual bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            var componentModel        = _serviceProvider.GetComponentModel();
            var dropdownBarFactory    = componentModel.DefaultExportProvider.GetExportedValueOrDefault <IEditorNavigationDropdownBarFactoryService>();
            var editorAdaptersFactory = componentModel.DefaultExportProvider.GetExportedValueOrDefault <IVsEditorAdaptersFactoryService>();

            editorAdaptersFactory.GetWpfTextView(_codeWindow.GetPrimaryView());
            var dropdownBarClient = dropdownBarFactory.CreateEditorNavigationDropdownBar(CodeWindow, editorAdaptersFactory);

            if (dropdownBarClient == null || dropdownBarClient.DropdownCount == 0)
            {
                comboBoxCount = 0;
                client        = null;
                return(false);
            }

            comboBoxCount = dropdownBarClient.DropdownCount;
            client        = dropdownBarClient;
            return(true);
        }
Esempio n. 16
0
        private int RemoveDropDownBar()
        {
            var manager = CodeWindow as IVsDropdownBarManager;
            if (manager == null)
                return VSConstants.E_FAIL;

            IVsDropdownBar dropdownBar;
            int hr = manager.GetDropdownBar(out dropdownBar);
            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                IVsDropdownBarClient client;
                hr = dropdownBar.GetClient(out client);
                if (ErrorHandler.Succeeded(hr) && client == _dropdownBarClient)
                {
                    _dropdownBarClient = null;
                    return manager.RemoveDropdownBar();
                }
            }

            _dropdownBarClient = null;
            return VSConstants.S_OK;
        }
Esempio n. 17
0
        private int AddDropdownBar(int comboBoxCount, IVsDropdownBarClient client)
        {
            var manager = CodeWindow as IVsDropdownBarManager;

            if (manager == null)
            {
                throw new NotSupportedException();
            }

            IVsDropdownBar dropdownBar;
            var            hr = manager.GetDropdownBar(out dropdownBar);

            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                hr = manager.RemoveDropdownBar();
                if (ErrorHandler.Failed(hr))
                {
                    return(hr);
                }
            }

            return(manager.AddDropdownBar(comboBoxCount, client));
        }
Esempio n. 18
0
        public virtual int AddAdornments()
        {
            IVsTextView textView;

            if (ErrorHandler.Succeeded(CodeWindow.GetPrimaryView(out textView)) && textView != null)
            {
                ErrorHandler.ThrowOnFailure(OnNewView(textView));
            }
            if (ErrorHandler.Succeeded(CodeWindow.GetSecondaryView(out textView)) && textView != null)
            {
                ErrorHandler.ThrowOnFailure(OnNewView(textView));
            }

            int comboBoxCount;
            IVsDropdownBarClient client;

            if (LanguagePreferences.ShowDropdownBar && TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }

            return(VSConstants.S_OK);
        }
Esempio n. 19
0
        protected virtual int AddDropdownBar(int comboBoxCount, IVsDropdownBarClient client)
        {
            Contract.Requires<ArgumentNullException>(client != null, "client");
            Contract.Requires<ArgumentOutOfRangeException>(comboBoxCount > 0);

            IVsDropdownBarManager manager = CodeWindow as IVsDropdownBarManager;
            if (manager == null)
                throw new NotSupportedException();

            IVsDropdownBar dropdownBar;
            int hr = manager.GetDropdownBar(out dropdownBar);
            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                hr = manager.RemoveDropdownBar();
                if (ErrorHandler.Failed(hr))
                    return hr;
            }

            return manager.AddDropdownBar(comboBoxCount, client);
        }
Esempio n. 20
0
 protected abstract bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client);
Esempio n. 21
0
 public int AddDropdownBar(int cCombos, IVsDropdownBarClient pClient)
 {
     return(VSConstants.E_FAIL);
 }
 public int AddDropdownBar(int cCombos, IVsDropdownBarClient pClient)
 {
     return DropdownBarManager.AddDropdownBar(cCombos, pClient);
 }
Esempio n. 23
0
        protected virtual void HandleLanguagePreferencesChanged(object sender, EventArgs e)
        {
            int num = 0;
            IVsDropdownBarClient client = null;

            //System.Diagnostics.Contracts.Contract.Requires<ArgumentNullException>(e != null, "e");
            if (((this._dropdownBarClient == null) && this.LanguagePreferences.ShowDropdownBar) && this.TryCreateDropdownBarClient(out num, out client))
            {
                ErrorHandler.ThrowOnFailure(this.AddDropdownBar(num, client));
                this._dropdownBarClient = client;
            }
            else if ((this._dropdownBarClient != null) && !this.LanguagePreferences.ShowDropdownBar)
            {
                ErrorHandler.ThrowOnFailure(this.RemoveDropdownBar());
            }
        }
Esempio n. 24
0
 protected abstract bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client);
Esempio n. 25
0
        protected virtual void HandleLanguagePreferencesChanged(object sender, EventArgs e)
        {
            Contract.Requires<ArgumentNullException>(e != null, "e");

            int comboBoxCount;
            IVsDropdownBarClient client;
            if (_dropdownBarClient == null && LanguagePreferences.ShowDropdownBar && TryCreateDropdownBarClient(out comboBoxCount, out client))
            {
                ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client));
                _dropdownBarClient = client;
            }
            else if (_dropdownBarClient != null && !LanguagePreferences.ShowDropdownBar)
            {
                ErrorHandler.ThrowOnFailure(RemoveDropdownBar());
            }
        }
Esempio n. 26
0
        public virtual int AddAdornments()
        {
            IVsTextView view;
            int num = 0;
            IVsDropdownBarClient client = null;

            if (ErrorHandler.Succeeded(this.CodeWindow.GetPrimaryView(out view)) && (view != null))
            {
                ErrorHandler.ThrowOnFailure(this.OnNewView(view));
            }
            if (ErrorHandler.Succeeded(this.CodeWindow.GetSecondaryView(out view)) && (view != null))
            {
                ErrorHandler.ThrowOnFailure(this.OnNewView(view));
            }
            if (this.LanguagePreferences.ShowDropdownBar && this.TryCreateDropdownBarClient(out num, out client))
            {
                ErrorHandler.ThrowOnFailure(this.AddDropdownBar(num, client));
                this._dropdownBarClient = client;
            }
            return 0;
        }
 public int AddDropdownBar(int cCombos, IVsDropdownBarClient pClient)
 {
     return(DropdownBarManager.AddDropdownBar(cCombos, pClient));
 }
Esempio n. 28
0
        private int AddDropdownBar(int comboBoxCount, IVsDropdownBarClient client)
        {
            var manager = CodeWindow as IVsDropdownBarManager;
            if (manager == null)
                throw new NotSupportedException();

            IVsDropdownBar dropdownBar;
            var hr = manager.GetDropdownBar(out dropdownBar);
            if (ErrorHandler.Succeeded(hr) && dropdownBar != null)
            {
                hr = manager.RemoveDropdownBar();
                if (ErrorHandler.Failed(hr))
                    return hr;
            }

            return manager.AddDropdownBar(comboBoxCount, client);
        }
Esempio n. 29
0
 int IVsDropdownBarManager.AddDropdownBar(int cCombos, IVsDropdownBarClient pClient) => ((IVsDropdownBarManager)_editorWindow).AddDropdownBar(cCombos, pClient);
Esempio n. 30
0
 protected virtual int AddDropdownBar(int comboBoxCount, IVsDropdownBarClient client)
 {
     IVsDropdownBar bar;
     System.Diagnostics.Contracts.Contract.Requires<ArgumentNullException>(client != null, "client");
     IVsDropdownBarManager codeWindow = this.CodeWindow as IVsDropdownBarManager;
     if (codeWindow == null)
     {
         throw new NotSupportedException();
     }
     if (ErrorHandler.Succeeded(codeWindow.GetDropdownBar(out bar)) && (bar != null))
     {
         int hr = codeWindow.RemoveDropdownBar();
         if (ErrorHandler.Failed(hr))
         {
             return hr;
         }
     }
     return codeWindow.AddDropdownBar(comboBoxCount, client);
 }
Esempio n. 31
0
        protected virtual bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            var componentModel = _serviceProvider.GetComponentModel();
            var dropdownBarFactory = componentModel.DefaultExportProvider.GetExportedValueOrDefault<IJavaEditorNavigationDropdownBarFactoryService>();
            var editorAdaptersFactory = componentModel.DefaultExportProvider.GetExportedValueOrDefault<IVsEditorAdaptersFactoryService>();

            editorAdaptersFactory.GetWpfTextView(_codeWindow.GetPrimaryView());
            var dropdownBarClient = dropdownBarFactory.CreateEditorNavigationDropdownBar(CodeWindow, editorAdaptersFactory);

            if (dropdownBarClient == null || dropdownBarClient.DropdownCount == 0)
            {
                comboBoxCount = 0;
                client = null;
                return false;
            }

            comboBoxCount = dropdownBarClient.DropdownCount;
            client = dropdownBarClient;
            return true;
        }
Esempio n. 32
0
        private bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            var componentModel = ServiceProvider.GetComponentModel();
            var editorAdaptersFactory = componentModel.DefaultExportProvider.GetExportedValueOrDefault<IVsEditorAdaptersFactoryService>();
            var bufferGraphFactoryService = componentModel.DefaultExportProvider.GetExportedValue<IBufferGraphFactoryService>();

            var textView = editorAdaptersFactory.GetWpfTextView(CodeWindow.GetPrimaryView());

            var editorNavigationSourceProvider = componentModel.DefaultExportProvider.GetExportedValueOrDefault<EditorNavigationSourceProvider>();
            var editorNavigationSource = editorNavigationSourceProvider.TryCreateEditorNavigationSource(textView.TextBuffer);

            comboBoxCount = 2;
            client = new EditorNavigationDropdownBarClient(CodeWindow, editorAdaptersFactory, editorNavigationSource, bufferGraphFactoryService);

            return true;
        }
Esempio n. 33
0
 protected virtual int RemoveDropdownBar()
 {
     IVsDropdownBar bar;
     IVsDropdownBarClient client;
     IVsDropdownBarManager codeWindow = this.CodeWindow as IVsDropdownBarManager;
     if (codeWindow == null)
     {
         return -2147467259;
     }
     if ((ErrorHandler.Succeeded(codeWindow.GetDropdownBar(out bar)) && (bar != null)) && (ErrorHandler.Succeeded(bar.GetClient(out client)) && (client == this._dropdownBarClient)))
     {
         this._dropdownBarClient = null;
         return codeWindow.RemoveDropdownBar();
     }
     this._dropdownBarClient = null;
     return 0;
 }
Esempio n. 34
0
 protected override bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
 {
     comboBoxCount = 0;
     client = null;
     return false;
 }
Esempio n. 35
0
 protected override bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
 {
     comboBoxCount = 0;
     client        = null;
     return(false);
 }