public DiffUpdateBackgroundParser(ITextBuffer textBuffer, ITextBuffer documentBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands commands) : base(textBuffer, taskScheduler, textDocumentFactoryService) { _documentBuffer = documentBuffer; _commands = commands; ReparseDelay = TimeSpan.FromMilliseconds(500); if (TextDocumentFactoryService.TryGetTextDocument(_documentBuffer, out _textDocument)) { if (_commands.IsGitRepository(_textDocument.FilePath)) { _textDocument.FileActionOccurred += OnFileActionOccurred; var solutionDirectory = _commands.GetGitRepository(_textDocument.FilePath); if (!string.IsNullOrWhiteSpace(solutionDirectory)) { var gitDirectory = Path.Combine(solutionDirectory, ".git"); _watcher = new FileSystemWatcher(gitDirectory); _watcher.Changed += HandleFileSystemChanged; _watcher.Created += HandleFileSystemChanged; _watcher.Deleted += HandleFileSystemChanged; _watcher.Renamed += HandleFileSystemChanged; _watcher.EnableRaisingEvents = true; } } } }
public DiffMarginViewModel(DiffMargin margin, IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands gitCommands) { if (margin == null) throw new ArgumentNullException("margin"); if (textView == null) throw new ArgumentNullException("textView"); if (textDocumentFactoryService == null) throw new ArgumentNullException("textDocumentFactoryService"); if (gitCommands == null) throw new ArgumentNullException("gitCommands"); _margin = margin; _textView = textView; _gitCommands = gitCommands; _diffViewModels = new ObservableCollection<DiffViewModel>(); _previousChangeCommand = new RelayCommand<DiffViewModel>(PreviousChange, PreviousChangeCanExecute); _nextChangeCommand = new RelayCommand<DiffViewModel>(NextChange, NextChangeCanExecute); _textView.LayoutChanged += OnLayoutChanged; _textView.ViewportHeightChanged += OnViewportHeightChanged; _parser = new DiffUpdateBackgroundParser(textView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService, gitCommands); _parser.ParseComplete += HandleParseComplete; _parser.RequestParse(false); }
internal DiffUpdateBackgroundParser(ITextBuffer textBuffer, ITextBuffer documentBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands commands) : base(textBuffer, taskScheduler, textDocumentFactoryService) { _documentBuffer = documentBuffer; _commands = commands; ReparseDelay = TimeSpan.FromMilliseconds(500); if (TextDocumentFactoryService.TryGetTextDocument(_documentBuffer, out _textDocument)) { if (_commands.IsGitRepository(_textDocument.FilePath)) { _textDocument.FileActionOccurred += OnFileActionOccurred; var repositoryDirectory = _commands.GetGitRepository(_textDocument.FilePath); if (repositoryDirectory != null) { _watcher = new FileSystemWatcher(repositoryDirectory); _watcher.Changed += HandleFileSystemChanged; _watcher.Created += HandleFileSystemChanged; _watcher.Deleted += HandleFileSystemChanged; _watcher.Renamed += HandleFileSystemChanged; _watcher.EnableRaisingEvents = true; } } } }
public DeleteUnusedBranchesForm(int days, IGitCommands gitCommands) { InitializeComponent(); this.days = days; this.gitCommands = gitCommands; }
public DeleteUnusedBranchesForm(int days, IGitCommands gitCommands) { InitializeComponent(); Days = days; GitCommands = gitCommands; Branches = new List<Branch>(); }
public DeleteUnusedBranchesForm(int days, string referenceBranch, IGitCommands gitCommands) { InitializeComponent(); this.referenceBranch = referenceBranch; this.days = days; this.gitCommands = gitCommands; instructionLabel.Text = "Choose branches to delete. Only branches that are fully merged in '" + referenceBranch + "' will be deleted."; }
internal DiffViewModel(GitDiffMargin margin, HunkRangeInfo hunkRangeInfo, IWpfTextView textView, IGitCommands gitCommands) { _margin = margin; _hunkRangeInfo = hunkRangeInfo; _textView = textView; _gitCommands = gitCommands; _margin.BrushesChanged += HandleBrushesChanged; ShowPopup = false; SetDisplayProperties(); DiffText = GetDiffText(); IsDiffTextVisible = GetIsDiffTextVisible(); }
public DiffMarginViewModel(IWpfTextView textView, IGitCommands gitCommands) { _textView = textView; _gitCommands = gitCommands; DiffViewModels = new ObservableCollection<DiffViewModel>(); _textView.Closed += TextViewClosed; _textView.TextBuffer.Changed += TextBufferChanged; _textView.LayoutChanged += OnLayoutChanged; _textView.ViewportHeightChanged += OnViewportHeightChanged; // Delay the initial check until the view gets focus _textView.GotAggregateFocus += GotAggregateFocus; _textView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof (ITextDocument), out _document); if (_document != null) { _document.FileActionOccurred += FileActionOccurred; } }
internal DiffMarginViewModel(GitDiffMargin margin, IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands gitCommands) { if (margin == null) throw new ArgumentNullException("margin"); if (textView == null) throw new ArgumentNullException("textView"); if (textDocumentFactoryService == null) throw new ArgumentNullException("textDocumentFactoryService"); if (gitCommands == null) throw new ArgumentNullException("gitCommands"); _margin = margin; _textView = textView; _gitCommands = gitCommands; DiffViewModels = new ObservableCollection<DiffViewModel>(); _textView.LayoutChanged += OnLayoutChanged; _parser = new DiffUpdateBackgroundParser(textView.TextBuffer, textView.TextDataModel.DocumentBuffer, TaskScheduler.Default, textDocumentFactoryService, gitCommands); _parser.ParseComplete += HandleParseComplete; _parser.RequestParse(false); }
public DiffUpdateBackgroundParser(ITextBuffer textBuffer, ITextBuffer documentBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands commands) : base(textBuffer, taskScheduler, textDocumentFactoryService) { _documentBuffer = documentBuffer; _commands = commands; ReparseDelay = TimeSpan.FromMilliseconds(500); ITextDocument textDocument; if (TextDocumentFactoryService.TryGetTextDocument(TextBuffer, out textDocument)) { GitFileStatusTracker tracker = new GitFileStatusTracker(Path.GetDirectoryName(textDocument.FilePath)); if (tracker.HasGitRepository && tracker.Repository.Resolve(Constants.HEAD) != null) { _watcher = new FileSystemWatcher(tracker.Repository.Directory.GetAbsolutePath()); _watcher.IncludeSubdirectories = true; _watcher.Changed += HandleFileSystemChanged; _watcher.Created += HandleFileSystemChanged; _watcher.Deleted += HandleFileSystemChanged; _watcher.Renamed += HandleFileSystemChanged; _watcher.EnableRaisingEvents = true; } } }
public MarginCore(IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IGitCommands gitCommands) { _textView = textView; _classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(textView); _editorFormatMap = editorFormatMapService.GetEditorFormatMap(textView); _editorFormatMap.FormatMappingChanged += HandleFormatMappingChanged; _gitCommands = gitCommands; _parser = new DiffUpdateBackgroundParser(textView.TextBuffer, textView.TextDataModel.DocumentBuffer, TaskScheduler.Default, textDocumentFactoryService, GitCommands); _parser.ParseComplete += HandleParseComplete; _parser.RequestParse(false); _textView.Closed += (sender, e) => { _editorFormatMap.FormatMappingChanged -= HandleFormatMappingChanged; _parser.ParseComplete -= HandleParseComplete; }; UpdateBrushes(); }
public DiffUpdateBackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands commands) : base(textBuffer, taskScheduler, textDocumentFactoryService) { _commands = commands; ReparseDelay = TimeSpan.FromMilliseconds(500); }