294
325
* @return a string representation of the <code>TextStyle</code>
296
327
public String toString () {
297
StringBuffer buffer = new StringBuffer("TextStyle {");
328
StringBuffer buffer = new StringBuffer("TextStyle {"); //$NON-NLS-1$
298
329
int startLength = buffer.length();
299
330
if (font != null) {
300
if (buffer.length() > startLength) buffer.append(", ");
301
buffer.append("font=");
331
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
332
buffer.append("font="); //$NON-NLS-1$
302
333
buffer.append(font);
304
335
if (foreground != null) {
305
if (buffer.length() > startLength) buffer.append(", ");
306
buffer.append("foreground=");
336
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
337
buffer.append("foreground="); //$NON-NLS-1$
307
338
buffer.append(foreground);
309
340
if (background != null) {
310
if (buffer.length() > startLength) buffer.append(", ");
311
buffer.append("background=");
341
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
342
buffer.append("background="); //$NON-NLS-1$
312
343
buffer.append(background);
315
if (buffer.length() > startLength) buffer.append(", ");
316
buffer.append("underlined");
346
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
347
buffer.append("underline="); //$NON-NLS-1$
348
switch (underlineStyle) {
349
case SWT.UNDERLINE_SINGLE: buffer.append("single"); break; //$NON-NLS-1$
350
case SWT.UNDERLINE_DOUBLE: buffer.append("double"); break; //$NON-NLS-1$
351
case SWT.UNDERLINE_SQUIGGLE: buffer.append("squiggle"); break; //$NON-NLS-1$
352
case SWT.UNDERLINE_ERROR: buffer.append("error"); break; //$NON-NLS-1$
353
case SWT.UNDERLINE_LINK: buffer.append("link"); break; //$NON-NLS-1$
355
if (underlineColor != null) {
356
buffer.append(", underlineColor="); //$NON-NLS-1$
357
buffer.append(underlineColor);
319
if (buffer.length() > startLength) buffer.append(", ");
320
buffer.append("striked out");
361
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
362
buffer.append("striked out"); //$NON-NLS-1$
363
if (strikeoutColor != null) {
364
buffer.append(", strikeoutColor="); //$NON-NLS-1$
365
buffer.append(strikeoutColor);
368
if (borderStyle != SWT.NONE) {
369
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
370
buffer.append("border="); //$NON-NLS-1$
371
switch (borderStyle) {
372
case SWT.BORDER_SOLID: buffer.append("solid"); break; //$NON-NLS-1$
373
case SWT.BORDER_DOT: buffer.append("dot"); break; //$NON-NLS-1$
374
case SWT.BORDER_DASH: buffer.append("dash"); break; //$NON-NLS-1$
376
if (borderColor != null) {
377
buffer.append(", borderColor="); //$NON-NLS-1$
378
buffer.append(borderColor);
323
if (buffer.length() > startLength) buffer.append(", ");
324
buffer.append("rise=");
382
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
383
buffer.append("rise="); //$NON-NLS-1$
325
384
buffer.append(rise);
327
386
if (metrics != null) {
328
if (buffer.length() > startLength) buffer.append(", ");
329
buffer.append("metrics=");
387
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
388
buffer.append("metrics="); //$NON-NLS-1$
330
389
buffer.append(metrics);
391
buffer.append("}"); //$NON-NLS-1$
333
392
return buffer.toString();