Beispiel #1
0
 public CSharpBar(IWpfTextView textView)
 {
     _View = textView;
     _SyntaxNodeRangeAdornment = _View.GetAdornmentLayer(SyntaxNodeRange);
     _SymbolListContainer      = new ExternalAdornment(_View);
     _SemanticContext          = textView.Properties.GetOrCreateSingletonProperty(() => new SemanticContext(textView));
     this.SetBackgroundForCrispImage(ThemeHelper.TitleBackgroundColor);
     textView.Properties.AddProperty(nameof(NaviBar), this);
     Name      = nameof(CSharpBar);
     Resources = SharedDictionaryManager.Menu;
     SetResourceReference(BackgroundProperty, VsBrushes.CommandBarMenuBackgroundGradientKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextInactiveKey);
     Items.Add(_RootItem = new RootItem(this));
     _View.Selection.SelectionChanged += Update;
     _View.Closed += ViewClosed;
     Update(this, EventArgs.Empty);
     if (_SemanticContext.Compilation != null)
     {
         foreach (var m in _SemanticContext.Compilation.Members)
         {
             if (m.IsKind(SyntaxKind.NamespaceDeclaration))
             {
                 _RootItem.SetText(m.GetDeclarationSignature());
                 break;
             }
         }
     }
 }