public MessageBubblePopoverWindow(MessageBubbleCache cache, MessageBubbleTextMarker marker)
 {
     this.cache  = cache;
     this.marker = marker;
     ShowArrow   = true;
     Opacity     = 0.9;
 }
			public MessageBubblePopoverWindow (MessageBubbleCache cache, MessageBubbleTextMarker marker)
			{
				this.cache = cache;
				this.marker = marker;
				ShowArrow = true;
				Opacity = 0.9;
			}
Example #3
0
 public MessageBubblePopoverWindow(MessageBubbleCache cache, MessageBubbleTextMarker marker)
 {
     this.cache        = cache;
     this.marker       = marker;
     ShowArrow         = true;
     Theme.ArrowLength = 7;
     TransientFor      = IdeApp.Workbench.RootWindow;
 }
 public MessageBubbleTextMarker(MessageBubbleCache cache)
 {
     if (cache == null)
     {
         throw new ArgumentNullException("cache");
     }
     this.cache     = cache;
     this.IsVisible = true;
 }
        internal MessageBubbleTextMarker(MessageBubbleCache cache, Task task, DocumentLine lineSegment, bool isError, string errorMessage)
        {
            this.cache       = cache;
            this.task        = task;
            this.IsVisible   = true;
            this.lineSegment = lineSegment;
            this.initialText = editor.Document.GetTextAt(lineSegment);
            this.Flags       = TextLineMarkerFlags.DrawsSelection;
            AddError(isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
        }
        internal MessageBubbleTextMarker(MessageBubbleCache cache, TaskListEntry task, bool isError, string errorMessage)
        {
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            this.cache   = cache;
            this.task    = task;
            this.isError = isError;
            AddError(task, isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
        }
        internal MessageBubbleTextMarker(MessageBubbleCache cache, Task task, DocumentLine lineSegment, bool isError, string errorMessage)
        {
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            this.cache       = cache;
            this.task        = task;
            this.IsVisible   = true;
            this.lineSegment = lineSegment;
            this.initialText = editor.Document.GetTextAt(lineSegment);
            this.isError     = isError;
            AddError(task, isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
        }
Example #8
0
		void DisposeErrorMarkers ()
		{
			//the window has a reference to the markers we're destroying
			//so if the error markers get cleared out while it's running, its expose will
			//NRE and bring down MD
			if (messageBubbleHighlightPopupWindow != null)
				messageBubbleHighlightPopupWindow.Destroy ();
			
			currentErrorMarkers.ForEach (em => {
				widget.Document.RemoveMarker (em);
				em.Dispose ();
			});
			currentErrorMarkers.Clear ();
			if (messageBubbleCache != null) {
				messageBubbleCache.Dispose ();
				messageBubbleCache = null;
			}
		}
Example #9
0
		void UpdateTasks (object sender, TaskEventArgs e)
		{
			Task[] tasks = TaskService.Errors.GetFileTasks (ContentName);
			if (tasks == null)
				return;
			DisposeErrorMarkers (); // disposes messageBubbleCache as well.
			if (IdeApp.Preferences.ShowMessageBubbles == ShowMessageBubbles.Never)
				return;
			using (var undo = Document.OpenUndoGroup ()) {
				if (messageBubbleCache != null)
					messageBubbleCache.Dispose ();
				messageBubbleCache = new MessageBubbleCache (widget.TextEditor);
				
				foreach (Task task in tasks) {
					if (task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning) {
						if (IdeApp.Preferences.ShowMessageBubbles == ShowMessageBubbles.ForErrors && task.Severity == TaskSeverity.Warning)
							continue;
						DocumentLine lineSegment = widget.Document.GetLine (task.Line);
						if (lineSegment == null)
							continue;
						var marker = currentErrorMarkers.FirstOrDefault (m => m.LineSegment == lineSegment);
						if (marker != null) {
							marker.AddError (task.Severity == TaskSeverity.Error, task.Description);
							continue;
						}
						MessageBubbleTextMarker errorTextMarker = new MessageBubbleTextMarker (messageBubbleCache, task, lineSegment, task.Severity == TaskSeverity.Error, task.Description);
						currentErrorMarkers.Add (errorTextMarker);
						
						errorTextMarker.IsVisible =  !IdeApp.Preferences.DefaultHideMessageBubbles;
						widget.Document.AddMarker (lineSegment, errorTextMarker, false);
					}
				}
			}
			widget.TextEditor.QueueDraw ();
		}
		internal MessageBubbleTextMarker (MessageBubbleCache cache, Task task, DocumentLine lineSegment, bool isError, string errorMessage)
		{
			if (cache == null)
				throw new ArgumentNullException ("cache");
			this.cache = cache;
			this.task = task;
			this.IsVisible = true;
			this.lineSegment = lineSegment;
			this.initialText = editor.Document.GetTextAt (lineSegment);
			this.isError = isError;
			AddError (task, isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
		}
Example #11
0
			public MessageBubblePopoverWindow (MessageBubbleCache cache, MessageBubbleTextMarker marker)
			{
				this.cache = cache;
				this.marker = marker;
				ShowArrow = true;
				Theme.ArrowLength = 7;
				TransientFor = IdeApp.Workbench.RootWindow;
			}
		void UpdateTasks (object sender, TaskEventArgs e)
		{
			TaskListEntry [] tasks = TaskService.Errors.GetFileTasks (ContentName);
			if (tasks == null)
				return;
			DisposeErrorMarkers (); // disposes messageBubbleCache as well.
			if (IdeApp.Preferences.ShowMessageBubbles == ShowMessageBubbles.Never)
				return;
			messageBubbleCache = new MessageBubbleCache (widget.TextEditor);
			CancelMessageBubbleUpdate ();
			var token = messageBubbleUpdateSource;

			Task.Run (delegate {
				var errorMarkers = new List<MessageBubbleTextMarker> ();
				foreach (TaskListEntry task in tasks) {
					if (token.IsCancellationRequested)
						return null;
					if (task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning) {
						if (IdeApp.Preferences.ShowMessageBubbles == ShowMessageBubbles.ForErrors && task.Severity == TaskSeverity.Warning)
							continue;
						var errorTextMarker = new MessageBubbleTextMarker (messageBubbleCache, task, task.Severity == TaskSeverity.Error, task.Description);
						errorMarkers.Add (errorTextMarker);

						errorTextMarker.IsVisible = !IdeApp.Preferences.DefaultHideMessageBubbles;
					}
				}
				return errorMarkers;
			}).ContinueWith (t => {
				if (token.IsCancellationRequested)
					return;
				Application.Invoke (delegate {
					if (token.IsCancellationRequested)
						return;
					var newErrorMarkers = new List<MessageBubbleTextMarker> ();
					foreach (var marker in t.Result) {
						if (token.IsCancellationRequested)
							return;
						var lineSegment = widget.Document.GetLine (marker.Task.Line);
						if (lineSegment == null)
							continue;
						var oldMarker = lineSegment.Markers.OfType<MessageBubbleTextMarker> ().FirstOrDefault ();
						if (oldMarker != null) {
							oldMarker.AddError (marker.Task, marker.Task.Severity == TaskSeverity.Error, marker.Task.Description);
						} else {
							marker.LineSegment = lineSegment;
							widget.Document.AddMarker (lineSegment, marker, false);
							newErrorMarkers.Add (marker);
						}
					}
					this.currentErrorMarkers = newErrorMarkers;
				});
			});
		}
		internal MessageBubbleTextMarker (MessageBubbleCache cache, Task task, LineSegment lineSegment, bool isError, string errorMessage)
		{
			this.cache = cache;
			this.task = task;
			this.IsVisible = true;
			this.lineSegment = lineSegment;
			this.initialText = editor.Document.GetTextAt (lineSegment);
			this.Flags = TextMarkerFlags.DrawsSelection;
			AddError (isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
		}
		internal MessageBubbleTextMarker (MessageBubbleCache cache, TaskListEntry task, bool isError, string errorMessage)
		{
			if (cache == null)
				throw new ArgumentNullException ("cache");
			this.cache = cache;
			this.task = task;
			this.isError = isError;
			AddError (task, isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
		}
		public MessageBubbleTextMarker (MessageBubbleCache cache)
		{
			if (cache == null)
				throw new ArgumentNullException ("cache");
			this.cache = cache;
			this.IsVisible = true;
		}