コード例 #1
0
        public void EndTaskWritte(object sender, string name, string status, List <TaskMessage> taskMessage)
        {
            Gtk.Application.Invoke(delegate
            {
                try {
                    foreach (ErrorMarker er in errors)
                    {
                        er.RemoveFromLine(editor.Document);                        //editor.Document.RemoveMarker(er.Line,typeof(ErrorMarker));
                    }
                    errors.Clear();

                    if (taskMessage != null)
                    {
                        foreach (TaskMessage tm in taskMessage)
                        {
                            LineSegment ls = editor.Document.GetLine(Convert.ToInt32(tm.Line) - 1);
                            ErrorMarker er = new ErrorMarker(ls);
                            er.AddToLine(editor.Document);
                            errors.Add(er);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Output NULL");
                    }
                } catch (Exception ex) {
                    //Tool.Logger.Error(ex.Message, null);
                    Tool.Logger.Error(ex.Message);
                    Tool.Logger.Error(ex.StackTrace);
                    Tool.Logger.Error(ex.Source);
                }
            });
        }
コード例 #2
0
        private void UnderlineErrors(IEnumerable <BuildError> parsedErrors)
        {
            if (_editor.IsDisposed || _editor.Disposing || !Enabled)
            {
                return;
            }

            if (_editor.InvokeRequired)
            {
                _editor.Invoke(() => UnderlineErrors(parsedErrors));
                return;
            }

            _document.MarkerStrategy.RemoveAll(m => m is ErrorMarker);
            var options = Settings.Default.CaseSensitive ?
                          StringComparison.Ordinal :
                          StringComparison.OrdinalIgnoreCase;

            foreach (BuildError error in parsedErrors.Where(
                         error => error.File == _editor.FileName))
            {
                var   segment = _document.GetLineSegment(error.LineNumber - 1);
                Match match   = Regex.Match(error.Description, "'(?<error>.*?)'");

                TextWord word;
                int      offset = segment.Offset;
                int      length;
                if (match.Success)
                {
                    word = segment.Words.FirstOrDefault(
                        s => s.Word.Equals(match.Groups["error"].Value, options)) ??
                           segment.Words.FirstOrDefault(w => !w.IsWhiteSpace);

                    length = match.Groups["error"].Length;
                }
                else
                {
                    word = segment.Words.FirstOrDefault(w => !w.IsWhiteSpace);
                    TextWord lastWord = segment.Words.Last(w => !w.IsWhiteSpace);
                    length = lastWord.Offset + lastWord.Length;
                }

                if (word != null)
                {
                    offset += word.Offset;
                }

                ErrorMarker marker = new ErrorMarker(offset, length, error.Description, error.IsWarning);
                _document.MarkerStrategy.AddMarker(marker);
            }
        }
コード例 #3
0
ファイル: EditorDocument.cs プロジェクト: derekdreery/D-IDE
            public static ErrorMarker Create(EditorDocument EditorDoc, GenericError Error)
            {
                var em = new ErrorMarker(EditorDoc, Error);

                em.ForegroundColor = Error.ForegroundColor;
                em.BackgroundColor = Error.BackgroundColor;
                if (Error.MarkerColor.HasValue)
                {
                    em.MarkerColor = Error.MarkerColor.Value;
                }

                // Init offsets manually
                try
                {
                    if (Error.Line >= EditorDoc.Editor.Document.LineCount)
                    {
                        return(null);
                    }

                    if (Error.Line == EditorDoc.Editor.Document.LineCount - 1 &&
                        EditorDoc.Editor.Document.Lines[Error.Line].Length > Error.Column)
                    {
                        return(null);
                    }

                    em.StartOffset = EditorDoc.Editor.Document.GetOffset(Error.Line, Error.Column);
                }
                catch
                {
                    return(null);
                }

                if (Error.Length > 0)
                {
                    em.Length = Error.Length;
                }
                else
                {
                    em.CalculateWordOffset(em.StartOffset, false);
                }

                return(em);
            }
コード例 #4
0
ファイル: EditorDocument.cs プロジェクト: derekdreery/D-IDE
        public void RefreshErrorHighlightings()
        {
            // Clear old markers
            foreach (var marker in MarkerStrategy.TextMarkers.ToArray())
            {
                if (marker is ErrorMarker)
                {
                    marker.Delete();
                }
            }

            foreach (var err in CoreManager.ErrorManagement.GetErrorsForFile(AbsoluteFilePath))
            {
                var m = ErrorMarker.Create(this, err);

                if (m != null)
                {
                    MarkerStrategy.Add(m);

                    m.Redraw();
                }
            }
        }
コード例 #5
0
 public void SetErrorPosition(ErrorMarker errorMarker, LatLon errorPosition)
 {
     _errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition);
 }
コード例 #6
0
 public ErrorPosition GetErrorPosition(ErrorMarker errorMarker)
 {
     return(_errorPositions[(int)errorMarker]);
 }
コード例 #7
0
ファイル: EditorDocument.cs プロジェクト: DinrusGroup/D-IDE
			public static ErrorMarker Create(EditorDocument EditorDoc, GenericError Error)
			{
				var em = new ErrorMarker(EditorDoc, Error);

				em.ForegroundColor = Error.ForegroundColor;
				em.BackgroundColor = Error.BackgroundColor;
				if (Error.MarkerColor.HasValue)
					em.MarkerColor = Error.MarkerColor.Value;

				// Init offsets manually
				try
				{
					if (Error.Line >= EditorDoc.Editor.Document.LineCount)
						return null;

					if (Error.Line == EditorDoc.Editor.Document.LineCount-1 &&
						EditorDoc.Editor.Document.Lines[Error.Line].Length > Error.Column)
						return null;

					em.StartOffset = EditorDoc.Editor.Document.GetOffset(Error.Line, Error.Column);
				}
				catch
				{
					return null;
				}

				if (Error.Length > 0)
					em.Length = Error.Length;
				else
					em.CalculateWordOffset(em.StartOffset, false);

				return em;
			}