Example #1
0
 public StructureVisualizerService(IWpfTextView wpfTextView, IEditorFormatMapService editorFormatMapService)
 {
     if (wpfTextView == null)
     {
         throw new ArgumentNullException(nameof(wpfTextView));
     }
     if (editorFormatMapService == null)
     {
         throw new ArgumentNullException(nameof(editorFormatMapService));
     }
     this.wpfTextView            = wpfTextView;
     this.editorFormatMapService = editorFormatMapService;
     this.structureVisualizerServiceDataProvider = NullStructureVisualizerServiceDataProvider.Instance;
     this.onRemovedDelegate = OnRemoved;
     this.lineElements      = new List <LineElement>();
     this.xPosCache         = new XPosCache(wpfTextView);
     this.lineColorInfos    = new List <LineColorInfo> {
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerNamespace),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerType),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerMethod),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerConditional),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerLoop),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerProperty),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerEvent),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerTry),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerCatch),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerFilter),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerFinally),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerFault),
         new LineColorInfo(ThemeClassificationTypeNameKeys.StructureVisualizerOther),
     };
     wpfTextView.Closed += WpfTextView_Closed;
     wpfTextView.Options.OptionChanged += Options_OptionChanged;
     UpdateEnabled();
 }
 void WpfTextView_Closed(object sender, EventArgs e)
 {
     UnregisterEvents();
     RemoveAllLineElements();
     ClearXPosCache();
     structureVisualizerServiceDataProvider = NullStructureVisualizerServiceDataProvider.Instance;
     wpfTextView.Closed -= WpfTextView_Closed;
     wpfTextView.Options.OptionChanged -= Options_OptionChanged;
 }
Example #3
0
 public void SetDataProvider(IStructureVisualizerServiceDataProvider dataProvider)
 {
     if (wpfTextView.IsClosed)
     {
         return;
     }
     this.structureVisualizerServiceDataProvider = dataProvider ?? NullStructureVisualizerServiceDataProvider.Instance;
     if (enabled)
     {
         RepaintAllLines();
     }
 }