void AppendText(MessageViewCategory category, string fullText, string text) { lock (appendCallLock) { if (pendingAppendCalls >= 5) { return; } pendingAppendCalls -= 1; } if (messageCategories[SelectedCategoryIndex] != category) { SelectCategory(category.Category, fullText); return; } if (text != null) { text = StringParser.Parse(text); textEditorControl.AppendText(text); textEditorControl.SelectionStart = textEditorControl.TextLength; /*textEditorControl.Document.ReadOnly = false; * textEditorControl.Document.Insert(textEditorControl.Document.TextLength, text); * textEditorControl.Document.ReadOnly = true; * textEditorControl.ActiveTextAreaControl.Caret.Position = new Point(0, textEditorControl.Document.TotalNumberOfLines); * textEditorControl.ActiveTextAreaControl.ScrollTo(textEditorControl.Document.TotalNumberOfLines);*/ } }
public void OnBeforeRunTestsWhenCodeCoverageMessageViewCreatedPreviouslyDoesNotCreateAnotherMessageView() { MessageViewCategory view = new MessageViewCategory("Test"); command.CodeCoverageMessageViewCategory = view; command.CallOnBeforeRunTests(); Assert.AreEqual(view, command.CodeCoverageMessageViewCategory); }
IOutputCategory IOutputPad.CreateCategory(string displayName) { var cat = new MessageViewCategory(displayName, displayName); AddCategory(cat); return(cat); }
void ClearText(MessageViewCategory category) { if (messageCategories[SelectedCategoryIndex] == category) { textEditorControl.Text = String.Empty; //textEditorControl.Refresh(); } }
/// <summary> /// Creates a new MessageViewCategory with the specified category /// and adds it to the CompilerMessageView pad. /// This method is thread-safe and works correctly even if called concurrently for the same /// category; only one messageViewCategory will be created. /// </summary> public static void Create(ref MessageViewCategory messageViewCategory, string category, string displayCategory) { MessageViewCategory newMessageViewCategory = new MessageViewCategory(category, displayCategory); if (System.Threading.Interlocked.CompareExchange(ref messageViewCategory, newMessageViewCategory, null) == null) { // this thread was successful creating the category, so add it CompilerMessageView.Instance.AddCategory(newMessageViewCategory); } }
public override void Run() { MessageViewCategory selectedMessageViewCategory = CompilerMessageView.Instance.SelectedMessageViewCategory; if (selectedMessageViewCategory != null) { selectedMessageViewCategory.ClearText(); } }
public void OnBeforeRunTestsClearsCodeCoverageMessageViewTextWithSafeAsyncCall() { MessageViewCategory view = new MessageViewCategory("Test"); view.AppendText("abc"); command.CodeCoverageMessageViewCategory = view; command.CallOnBeforeRunTests(); Assert.AreEqual(String.Empty, view.Text); }
IOutputCategory GetOrCreateCategory(string displayName) { foreach (var cat in messageCategories) { if (cat.DisplayCategory == displayName) return cat; } var newcat = new MessageViewCategory(displayName, displayName); AddCategory(newcat); return newcat; }
public void SelectCategory(string categoryName) { for (int i = 0; i < messageCategories.Count; ++i) { MessageViewCategory category = (MessageViewCategory)messageCategories[i]; if (category.Category == categoryName) { SelectedCategoryIndex = i; break; } } }
/// <summary> /// Adds a category to the compiler message view. This method is thread-safe. /// </summary> public void AddCategory(MessageViewCategory category) { if (SD.MainThread.InvokeRequired) { SD.MainThread.InvokeAsyncAndForget(() => AddCategory(category)); return; } messageCategories.Add(category); category.TextSet += new TextEventHandler(CategoryTextSet); category.TextAppended += new TextEventHandler(CategoryTextAppended); OnMessageCategoryAdded(EventArgs.Empty); }
/// <summary> /// Adds a category to the compiler message view. This method is thread-safe. /// </summary> public void AddCategory(MessageViewCategory category) { if (WorkbenchSingleton.InvokeRequired) { WorkbenchSingleton.SafeThreadAsyncCall((Action <MessageViewCategory>)AddCategory, category); return; } messageCategories.Add(category); category.TextSet += new TextEventHandler(CategoryTextSet); category.TextAppended += new TextEventHandler(CategoryTextAppended); OnMessageCategoryAdded(EventArgs.Empty); }
void SelectCategory(string categoryName, string text) { for (int i = 0; i < messageCategories.Count; ++i) { MessageViewCategory category = (MessageViewCategory)messageCategories[i]; if (category.Category == categoryName) { selectedCategory = i; textEditor.Text = StringParser.Parse(text); OnSelectedCategoryIndexChanged(EventArgs.Empty); break; } } }
IOutputCategory GetOrCreateCategory(string displayName) { foreach (var cat in messageCategories) { if (cat.DisplayCategory == displayName) { return(cat); } } var newcat = new MessageViewCategory(displayName, displayName); AddCategory(newcat); return(newcat); }
public void SelectCategory(string categoryName) { for (int i = 0; i < messageCategories.Count; ++i) { MessageViewCategory category = (MessageViewCategory)messageCategories[i]; if (category.Category == categoryName) { SelectedCategoryIndex = i; break; } } if (!this.IsVisible) { ActivateThisPad(); } }
void CategoryTextAppended(object sender, TextEventArgs e) { lock (appendCallLock) { pendingAppendCalls += 1; MessageViewCategory cat = (MessageViewCategory)sender; if (pendingAppendCalls < 5) { WorkbenchSingleton.SafeThreadAsyncCall(new Action <MessageViewCategory, string, string>(AppendText), cat, cat.Text, e.Text); } else if (pendingAppendCalls == 5) { WorkbenchSingleton.SafeThreadAsyncCall(new Action <MessageViewCategory>(AppendTextCombined), cat); } } }
void AppendTextCombined(MessageViewCategory category) { Application.DoEvents(); Thread.Sleep(50); Application.DoEvents(); lock (appendCallLock) { SetUpdate(false); SetText(category, category.Text); SetUpdate(true); textEditorControl.SelectionStart = textEditorControl.TextLength; if (LoggingService.IsDebugEnabled) { LoggingService.Debug("Replaced " + pendingAppendCalls + " appends with one set call"); } pendingAppendCalls = 0; } textEditorControl.Refresh(); }
void SetText(MessageViewCategory category, string text) { if (messageCategories[SelectedCategoryIndex] != category) { SelectCategory(category.Category); return; } if (text == null) { text = String.Empty; } else { text = StringParser.Parse(text); } textEditorControl.Text = text; //textEditorControl.Refresh(); }
void AppendText(MessageViewCategory category, string fullText, string text) { lock (appendCallLock) { if (pendingAppendCalls >= 5) { return; } pendingAppendCalls -= 1; } if (messageCategories[SelectedCategoryIndex] != category) { SelectCategory(category.Category, fullText); return; } if (text != null) { text = StringParser.Parse(text); textEditorControl.AppendText(text); textEditorControl.SelectionStart = textEditorControl.TextLength; /*textEditorControl.Document.ReadOnly = false; textEditorControl.Document.Insert(textEditorControl.Document.TextLength, text); textEditorControl.Document.ReadOnly = true; textEditorControl.ActiveTextAreaControl.Caret.Position = new Point(0, textEditorControl.Document.TotalNumberOfLines); textEditorControl.ActiveTextAreaControl.ScrollTo(textEditorControl.Document.TotalNumberOfLines);*/ } }
void ProcessAppendText() { List <AppendCall> appendCalls; lock (appendLock) { appendCalls = this.appendCalls; this.appendCalls = new List <AppendCall>(); } Debug.Assert(appendCalls.Count > 0); if (appendCalls.Count == 0) { return; } MessageViewCategory newCategory = appendCalls[appendCalls.Count - 1].Category; if (messageCategories[SelectedCategoryIndex] != newCategory) { SelectCategory(newCategory.Category); return; } bool clear; string text; if (appendCalls.Count == 1) { //LoggingService.Debug("CompilerMessageView: Single append."); clear = appendCalls[0].ClearCategory; text = appendCalls[0].Text; } else { if (LoggingService.IsDebugEnabled) { LoggingService.Debug("CompilerMessageView: Combined " + appendCalls.Count + " appends."); } clear = false; StringBuilder b = new StringBuilder(); foreach (AppendCall append in appendCalls) { if (append.Category == newCategory) { if (append.ClearCategory) { b.Length = 0; clear = true; } b.Append(append.Text); } } text = b.ToString(); } //NativeMethods.SetWindowRedraw(textEditorControl.Handle, false); if (clear) { textEditorControl.Text = text; } else { textEditorControl.SelectionStart = textEditorControl.TextLength; textEditorControl.SelectedText = text; } //NativeMethods.SetWindowRedraw(textEditorControl.Handle, true); textEditorControl.SelectionStart = textEditorControl.TextLength; }
public PackageManagementMessageViewCategory(MessageViewCategory messageViewCategory) { this.messageViewCategory = messageViewCategory; }
public AppendCall(MessageViewCategory category, string text, bool clearCategory) { this.Category = category; this.Text = text; this.ClearCategory = clearCategory; }
public MessageViewSink(ICSharpCode.SharpDevelop.Gui.MessageViewCategory messageView) { this.messageView = messageView; }
IOutputCategory IOutputPad.CreateCategory(string displayName) { var cat = new MessageViewCategory(displayName, displayName); AddCategory(cat); return cat; }
static async Task DisplayErrorStreamAsync(ProcessRunner runner, MessageViewCategory category) { using (var reader = runner.OpenStandardErrorReader()) { bool hasErrors = false; string line; while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null) { if (!hasErrors) { hasErrors = true; GitMessageView.AppendLine(runner.WorkingDirectory + "> " + runner.CommandLine); } GitMessageView.AppendLine(line); } } }
public MessageViewCategoryWriter(MessageViewCategory category) { if (category == null) throw new ArgumentNullException("category"); this.category = category; }
/// <summary> /// Adds a category to the compiler message view. This method is thread-safe. /// </summary> public void AddCategory(MessageViewCategory category) { if (WorkbenchSingleton.InvokeRequired) { WorkbenchSingleton.SafeThreadAsyncCall((Action<MessageViewCategory>)AddCategory, category); return; } messageCategories.Add(category); category.TextSet += new TextEventHandler(CategoryTextSet); category.TextAppended += new TextEventHandler(CategoryTextAppended); OnMessageCategoryAdded(EventArgs.Empty); }
/// <summary> /// Creates a new MessageViewCategory with the specified category /// and adds it to the CompilerMessageView pad. /// This method is thread-safe and works correctly even if called concurrently for the same /// category; only one messageViewCategory will be created. /// </summary> public static void Create(ref MessageViewCategory messageViewCategory, string category) { Create(ref messageViewCategory, category, category); }
public MessageViewSink(MessageViewCategory messageView, IProgressMonitor progressMonitor, IStatusBarService statusBarService) { Debug.Assert(messageView != null); Debug.Assert(progressMonitor != null); Debug.Assert(statusBarService != null); this.messageView = messageView; this.progressMonitor = progressMonitor; this.statusBarService = statusBarService; }
void CreateCodeCoverageMessageViewCategory() { string displayCategory = StringParse("${res:ICSharpCode.UnitTesting.CodeCoverage}"); category = CreateMessageViewCategory("CodeCoverage", displayCategory); }