internal EditorDiffMargin(IWpfTextView textView, UnifiedDiff unifiedDiff, IMarginCore marginCore) : base(textView) { ViewModel = new EditorDiffMarginViewModel(marginCore, unifiedDiff, UpdateDiffDimensions); UserControl = new EditorDiffMarginControl {DataContext = ViewModel, Width = MarginWidth}; }
//private void Rollback() //{ // if (!MarginCore.RollBack(HunkRangeInfo)) return; // // immediately hide the change // _reverted = true; // //ShowPopup = false; // IsVisible = false; // // Make sure the view is focused afterwards // MarginCore.TextView.VisualElement.Focus(); //} private void ShowPopUp(EditorDiffMarginViewModel diffMarginViewModel) { _diffMarginViewModel = diffMarginViewModel; ShowPopup = true; }
private bool TryGetMarginViewModel(out EditorDiffMarginViewModel viewModel) { viewModel = null; IWpfTextViewHost textViewHost = _editorAdaptersFactoryService.GetWpfTextViewHost(TextViewAdapter); if (textViewHost == null) return false; EditorDiffMargin margin = textViewHost.GetTextViewMargin(EditorDiffMargin.MarginNameConst) as EditorDiffMargin; if (margin == null) return false; viewModel = margin.VisualElement.DataContext as EditorDiffMarginViewModel; return viewModel != null; }