[RichTextPainter] IllegalArgumentException in ResetSpanStylePaintInstruction [message #1743513] |
Fri, 16 September 2016 06:52  |
Eclipse User |
|
|
|
Whenever I have nested span elements like in the following HTML:
Quote:<span style="color:rgb(255, 0, 0)"><span style="color:rgb(210, 105, 30)">ERROR, STOP_FTC:SAS_Startup failed for ODN_SAS:Ground_Common: COMMUNICATION_ERROR: Error on the communication channel</span></span>
The painter throws an IllegalArgumentException:
Quote:Caused by: java.lang.IllegalArgumentException: Argument cannot be null
at org.eclipse.swt.SWT.error(SWT.java:4472)
at org.eclipse.swt.SWT.error(SWT.java:4406)
at org.eclipse.swt.SWT.error(SWT.java:4377)
at org.eclipse.swt.graphics.GC.setForeground(GC.java:3513)
at org.eclipse.nebula.widgets.richtext.painter.instructions.ResetSpanStylePaintInstruction.paint(ResetSpanStylePaintInstruction.java:40)
The problem is that the ResetSpanStylePaintInstruction sets the state color to null instead to the color of the parent span. So when there are two adjacent </span> elements, the first one sets the state color to null and the second one then sets the gc foreground to null.
Shall I file a bug for this, or am I doing something wrong?
|
|
|
|
|
Re: [RichTextPainter] IllegalArgumentException in ResetSpanStylePaintInstruction [message #1743527 is a reply to message #1743521] |
Fri, 16 September 2016 08:33   |
Eclipse User |
|
|
|
The problem is that the html formatting directives are inserted into normal text by markup display converters (working with user defined regular expressions). Since I have no control over the converters defined by the users, I somehow have to make this work. One possibility obviously would be to remove all superfluous markup before passing the text to the painter, but that would not fix all cases. If the HTML looked like this:
Quote:<span style="color:rgb(255, 0, 0)">lots of text with red color in a the top span<span style="color:rgb(210, 105, 30)">some more text with a different color</span></span>
removing spans would no longer work.
[Updated on: Fri, 16 September 2016 08:35] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03511 seconds