public ICodeLensDataPoint CreateDataPoint(ICodeLensDescriptor descriptor) { if (serviceProvider == null) { return(null); } ICodeElementDescriptor codeElement = descriptor as ICodeElementDescriptor; string filePath = codeElement.FilePath; EditingSession editingSession = EditingSessionFactory.WaitForSession(filePath); return(new ConflictDataPoint(editingSession, codeElement)); }
/// <summary> /// Creates a square image and attaches an event handler to the layout changed event that /// adds the the square in the upper right-hand corner of the TextView via the adornment layer /// </summary> /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param> public ConflictPopupAdornment(IWpfTextView view) { _view = view; _adornmentLayer = view.GetAdornmentLayer("ConflictPopupAdornment"); string filePath = _view.GetDocumentFullPath(); if (filePath != null) { this.editingSession = EditingSessionFactory.WaitForSession(_view.GetDocumentFullPath()); editingSession.ConflictDataChanged += editingSession_ConflictDataChanged; } _view.ViewportHeightChanged += delegate { this.onSizeChange(); }; _view.ViewportWidthChanged += delegate { this.onSizeChange(); }; }
private static async void tfsQueryHistoryTimer_Elapsed(object sender, ElapsedEventArgs e) { IVsWindowFrame vsWindowFrame = ShellHelper.GetActiveWindowFrame(serviceProvider); if (vsWindowFrame != null) { object pvar = null; vsWindowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_pszMkDocument, out pvar); string fullPath = pvar as string; if (fullPath != null) { EditingSession activeSession = EditingSessionFactory.WaitForSession(fullPath); if (activeSession != null) { tfsQueryHistoryTimer.Enabled = false; await activeSession.RecalculateConflicts(ForceCheckForNewVersion.LatestVersion); tfsQueryHistoryTimer.Enabled = true; } } } }
public ConflictTextAdornment(IWpfTextView view, IEditorFormatMap editorFormatMap) { _view = view; _layer = view.GetAdornmentLayer("ConflictTextAdornment"); //Listen to any event that changes the layout (text changes, scrolling, etc) _view.LayoutChanged += OnLayoutChanged; SolidColorBrush b = (SolidColorBrush)editorFormatMap.GetProperties(ConflictRegionFormatDefinition.Name)[EditorFormatDefinition.BackgroundBrushId];; _brush = new SolidColorBrush(Color.FromArgb((byte)(Opacity * 255), b.Color.R, b.Color.G, b.Color.B)); Brush penBrush = (SolidColorBrush)editorFormatMap.GetProperties(ConflictRegionFormatDefinition.Name)[EditorFormatDefinition.ForegroundBrushId];; penBrush.Freeze(); _pen = new Pen(penBrush, 1); string filePath = _view.GetDocumentFullPath(); if (filePath != null) { this.editingSession = EditingSessionFactory.WaitForSession(_view.GetDocumentFullPath()); editingSession.ConflictDataChanged += editingSession_ConflictDataChanged; } }