public DropdownBarClient(
            ITextBuffer textBuffer,
            IVsDropdownBarManager manager,
            IVsCodeWindow codeWindow,            
            IServiceProvider serviceProvider): base(textBuffer) {

            Logger.Trace($"{nameof(DropdownBarClient)}:Ctor");

            _manager          = manager;
            _codeWindow       = codeWindow;
            _serviceProvider  = serviceProvider;
            _projectItems     = ImmutableList<NavigationItem>.Empty;
            _taskItems        = ImmutableList<NavigationItem>.Empty;
            _dispatcher       = Dispatcher.CurrentDispatcher;
            _activeSelections = new Dictionary<int, int>();
            _focusedCombo     = -1;
            _trackedViews     = new Dictionary<IVsTextView, IWpfTextView>();

            _workspaceRegistration = Workspace.GetWorkspaceRegistration(TextBuffer.AsTextContainer());
            _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;
            VSColorTheme.ThemeChanged += OnThemeChanged;

            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
            _editorAdaptersFactoryService=componentModel.GetService<IVsEditorAdaptersFactoryService>();

            _comEventSink = ComEventSink.Advise<IVsCodeWindowEvents>(codeWindow, this);

            IVsTextView pTextView;
            codeWindow.GetPrimaryView(out pTextView);            
            ConnectView(pTextView);

            codeWindow.GetSecondaryView(out pTextView);
            ConnectView(pTextView);

            ConnectToWorkspace(_workspaceRegistration.Workspace);

            UpdateImageList();
        }
예제 #2
0
 private bool IsClaimedByAnotherWorkspace(WorkspaceRegistration registration)
 {
     // Currently, we are also responsible for pushing documents to the metadata as source workspace,
     // so we count that here as well
     return registration.Workspace != null && registration.Workspace.Kind != WorkspaceKind.MetadataAsSource && registration.Workspace.Kind != WorkspaceKind.MiscellaneousFiles;
 }