Exemplo n.º 1
0
        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);
		}
Exemplo n.º 3
0
        IOutputCategory IOutputPad.CreateCategory(string displayName)
        {
            var cat = new MessageViewCategory(displayName, displayName);

            AddCategory(cat);
            return(cat);
        }
Exemplo n.º 4
0
 void ClearText(MessageViewCategory category)
 {
     if (messageCategories[SelectedCategoryIndex] == category)
     {
         textEditorControl.Text = String.Empty;
         //textEditorControl.Refresh();
     }
 }
Exemplo n.º 5
0
		/// <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);
			}
		}
Exemplo n.º 6
0
        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);
		}
Exemplo n.º 8
0
        /// <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);
            }
        }
Exemplo n.º 9
0
		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;
		}
Exemplo n.º 10
0
 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;
         }
     }
 }
Exemplo n.º 11
0
        /// <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);
        }
Exemplo n.º 12
0
        /// <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);
        }
Exemplo n.º 13
0
 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;
         }
     }
 }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
 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();
     }
 }
Exemplo n.º 16
0
 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);
         }
     }
 }
Exemplo n.º 17
0
 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();
 }
Exemplo n.º 18
0
 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();
 }
Exemplo n.º 19
0
		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);*/
			}
		}
Exemplo n.º 20
0
		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();
		}
Exemplo n.º 21
0
		void ClearText(MessageViewCategory category)
		{
			if (messageCategories[SelectedCategoryIndex] == category) {
				textEditorControl.Text = String.Empty;
				//textEditorControl.Refresh();
			}
		}
Exemplo n.º 22
0
        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;
		}
Exemplo n.º 24
0
			public AppendCall(MessageViewCategory category, string text, bool clearCategory)
			{
				this.Category = category;
				this.Text = text;
				this.ClearCategory = clearCategory;
			}
Exemplo n.º 25
0
 public MessageViewSink(ICSharpCode.SharpDevelop.Gui.MessageViewCategory messageView)
 {
     this.messageView = messageView;
 }
Exemplo n.º 26
0
		IOutputCategory IOutputPad.CreateCategory(string displayName)
		{
			var cat = new MessageViewCategory(displayName, displayName);
			AddCategory(cat);
			return cat;
		}
Exemplo n.º 27
0
		/// <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);
		}
Exemplo n.º 28
0
		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);
				}
			}
		}
Exemplo n.º 29
0
		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();
		}
 public MessageViewCategoryWriter(MessageViewCategory category)
 {
     if (category == null)
         throw new ArgumentNullException("category");
     this.category = category;
 }
Exemplo n.º 31
0
		/// <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);
		}
Exemplo n.º 32
0
 public AppendCall(MessageViewCategory category, string text, bool clearCategory)
 {
     this.Category      = category;
     this.Text          = text;
     this.ClearCategory = clearCategory;
 }
Exemplo n.º 33
0
		/// <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);
		}
Exemplo n.º 34
0
 /// <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);
 }
Exemplo n.º 35
0
			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);
		}