Source:
<code>public void paintHTML(String text, int width, int height, int x, int y) { <START> if <END> (renderFigure == null || painter == null || contentPane == null) { return; } Image htmlImage_tmp = new Image(Display.getDefault(), 10, 10); GC gc_tmp = new GC(htmlImage_tmp); Rectangle bounds_tmp = new Rectangle(x, y, 0, 0); painter.preCalculate(text != null ? text : "", gc_tmp, bounds_tmp, false); width = this.painter.getPreferredSize().x; height = this.painter.getPreferredSize().y; if (!validated) { contentPane.setPreferredSize(width, height); contentPane.validate(); } if (htmlImage != null) { htmlImage.dispose(); } htmlImage = getTransparentBackground(Display.getDefault(), width, height); if (htmlImage == null) { htmlImage = new Image(Display.getDefault(), width, height); } if (htmlImage != null) { GC gc = new GC(htmlImage); Rectangle bounds = new Rectangle(x, y, width, height); painter.preCalculate(text != null ? text : "", gc, bounds, true); boolean changeBounds = false; if (width < getPreferredSize().x) { width = getPreferredSize().x; changeBounds = true; } if (height < getPreferredSize().y) { height = getPreferredSize().y; changeBounds = true; } if (changeBounds) { gc.dispose(); htmlImage.dispose(); htmlImage = getTransparentBackground(Display.getDefault(), width, height); if (htmlImage == null) { htmlImage = new Image(Display.getDefault(), width, height); } gc = new GC(htmlImage); bounds = new Rectangle(x, y, width, height); } painter.paintHTML(text != null ? text : "", gc, bounds); if (gc != null) { gc.dispose(); } renderFigure.setImage(htmlImage); } }</code><technical_language>extracting method other paintHTML(String text, int x, int y) show 2 parameters unused</technical_language>

Target:
public void paintHTML(String text, int width, int height, int x, int y) { if (renderFigure == null || painter == null || contentPane == null) { return; } Image htmlImage_tmp = new Image(Display.getDefault(), 10, 10); GC gc_tmp = new GC(htmlImage_tmp); Rectangle bounds_tmp = new Rectangle(x, y, 10,10); painter.preCalculate(text != null ? text : "", gc_tmp, bounds_tmp, false); width = this.painter.getPreferredSize().x; height = this.painter.getPreferredSize().y; if (!validated) { contentPane.setPreferredSize(width, height); contentPane.validate(); } if (htmlImage != null) { htmlImage.dispose(); } htmlImage = getTransparentBackground(Display.getDefault(), width, height); if (htmlImage == null) { htmlImage = new Image(Display.getDefault(), width, height); } if (htmlImage != null) { GC gc = new GC(htmlImage); Rectangle bounds = new Rectangle(x, y, width, height); painter.preCalculate(text != null ? text : "", gc, bounds, true); boolean changeBounds = false; if (width < getPreferredSize().x) { width = getPreferredSize().x; changeBounds = true; } if (height < getPreferredSize().y) { height = getPreferredSize().y; changeBounds = true; } if (changeBounds) { gc.dispose(); htmlImage.dispose(); htmlImage = getTransparentBackground(Display.getDefault(), width, height); if (htmlImage == null) { htmlImage = new Image(Display.getDefault(), width, height); } gc = new GC(htmlImage); bounds = new Rectangle(x, y, width, height); } painter.paintHTML(text != null ? text : "", gc, bounds); if (gc != null) { gc.dispose(); } renderFigure.setImage(htmlImage); } }