Ejemplo n.º 1
0
        internal void Layout(ITextMeasure measure, float contentWidth, float maxWidth)
        {
            if (this.IsPlain)
            {
                if (this.level == LogLevel.Exception)
                {
                    StackTraceLine[] stackLines = this.data as StackTraceLine[];
                    if (stackLines == null && this.stackTrace != null)
                    {
                        stackLines = EditorStackTrace.ParseStackTrace(this.stackTrace);
                        this.data  = stackLines;
                    }

                    LayoutException(measure, stackLines, maxWidth);
                }
                else
                {
                    LayoutPlain(measure, maxWidth);
                }
            }
            else if (this.IsTable)
            {
                string[] table = this.Table;
                Assert.IsNotNull(table);

                LayoutTable(measure, table, contentWidth, maxWidth);
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }
Ejemplo n.º 2
0
        private string FormatLine(string line, LogLevel level, Tag tag, string stackTrace)
        {
            RecyclableStringBuilder lineBuffer = StringBuilderPool.NextBuilder();

            string coloredLine = EditorSkin.SetColors(line);

            string filename = EditorStackTrace.ExtractFileName(stackTrace);

            if (level != null)
            {
                lineBuffer.Append("[");
                lineBuffer.Append(level.ShortName);
                lineBuffer.Append("]: ");
            }

            if (filename != null)
            {
                lineBuffer.Append(StringUtils.C("[" + filename + "]: ", EditorSkin.GetColor(ColorCode.Plain)));
            }

            if (tag != null)
            {
                lineBuffer.Append("[");
                lineBuffer.Append(tag.Name);
                lineBuffer.Append("]: ");
            }

            lineBuffer.Append(coloredLine);

            string result = lineBuffer.ToString();

            lineBuffer.Recycle(); // don't trash timer manager with this call

            return(result);
        }
Ejemplo n.º 3
0
        //////////////////////////////////////////////////////////////////////////////

        public override bool OnMouseDoubleClick(Event evt)
        {
            if (!string.IsNullOrEmpty(StackTrace))
            {
                if (Editor.OpenFileExternal(StackTrace))
                {
                    return(true);
                }
            }
            else if (this.LogLevel == LogLevel.Error || this.LogLevel == LogLevel.Warn)
            {
                SourcePathEntry element;
                if (EditorStackTrace.TryParseCompilerMessage(m_value, out element))
                {
                    if (Editor.OpenFileAtLineExternal(element.sourcePath, element.lineNumber))
                    {
                        return(true);
                    }
                }
            }

            return(base.OnMouseDoubleClick(evt));
        }