diff options
author | Lars Vogel | 2018-01-18 16:44:53 +0000 |
---|---|---|
committer | Lars Vogel | 2018-01-18 16:44:53 +0000 |
commit | 432db08619cda4364032721bf730f48194237ce6 (patch) | |
tree | b25b161429596523c7f19db7e0d6082f97a39b18 | |
parent | 0767984d103c762708f7930f081d1493ee589679 (diff) | |
download | eclipse.platform.text-432db08619cda4364032721bf730f48194237ce6.tar.gz eclipse.platform.text-432db08619cda4364032721bf730f48194237ce6.tar.xz eclipse.platform.text-432db08619cda4364032721bf730f48194237ce6.zip |
Bug 519783 - HTMLPrinter should migrate to StringBuilder
Removes the temporary internal HTMLPrinter
Change-Id: I960abc290764e38de7eaaaaa445cc84637193267
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java | 340 |
1 files changed, 0 insertions, 340 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java index 3b4e85fb9b6..f67dcf7e5dd 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java @@ -159,34 +159,6 @@ public class HTMLPrinter { /** * - * @deprecated migrate to new StringBuilder API - * - * @param buffer the output StringBuilder - * @param position offset where the prolog is placed - * @param fgRGB Foreground-Color - * @param bgRGB Background-Color - * @param styleSheet Stylesheet - */ - @Deprecated - public static void insertPageProlog(StringBuffer buffer, int position, RGB fgRGB, RGB bgRGB, String styleSheet) { - if (fgRGB == null) - fgRGB= FG_COLOR_RGB; - if (bgRGB == null) - bgRGB= BG_COLOR_RGB; - - StringBuffer pageProlog= new StringBuffer(300); - - pageProlog.append("<html>"); //$NON-NLS-1$ - - appendStyleSheet(pageProlog, styleSheet, fgRGB, bgRGB); - - appendColors(pageProlog, fgRGB, bgRGB); - - buffer.insert(position, pageProlog.toString()); - } - - /** - * * @param buffer the output StringBuilder * @param position offset where the prolog is placed * @param fgRGB Foreground-Color @@ -229,24 +201,6 @@ public class HTMLPrinter { /** * * - * @param pageProlog The Pageprolog where the color has to be set - * @param fgRGB Foreground-Color - * @param bgRGB Background-Color - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - private static void appendColors(StringBuffer pageProlog, RGB fgRGB, RGB bgRGB) { - pageProlog.append("<body text=\""); //$NON-NLS-1$ - appendColor(pageProlog, fgRGB); - pageProlog.append("\" bgcolor=\""); //$NON-NLS-1$ - appendColor(pageProlog, bgRGB); - pageProlog.append("\">"); //$NON-NLS-1$ - } - - /** - * - * * @param buffer The Output buffer * @param rgb RGB-Value * @@ -260,22 +214,6 @@ public class HTMLPrinter { /** * - * - * @param buffer The Output buffer - * @param rgb RGB-Value - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - private static void appendColor(StringBuffer buffer, RGB rgb) { - buffer.append('#'); - appendAsHexString(buffer, rgb.red); - appendAsHexString(buffer, rgb.green); - appendAsHexString(buffer, rgb.blue); - } - - /** - * * @param buffer the output buffer * @param intValue the intValue will be converted to hex and appended * @@ -290,21 +228,6 @@ public class HTMLPrinter { /** * * @param buffer the output buffer - * @param intValue the intValue will be converted to hex and appended - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - private static void appendAsHexString(StringBuffer buffer, int intValue) { - String hexValue= Integer.toHexString(intValue); - if (hexValue.length() == 1) - buffer.append('0'); - buffer.append(hexValue); - } - - /** - * - * @param buffer the output buffer * @param styles array with styles to be appended * */ @@ -340,42 +263,6 @@ public class HTMLPrinter { /** * * @param buffer the output buffer - * @param styles array with styles to be appended - * - * @deprecated As of 3.13, replaced by {@link #insertStyles(StringBuilder, String[])} - */ - @Deprecated - public static void insertStyles(StringBuffer buffer, String[] styles) { - if (styles == null || styles.length == 0) - return; - - StringBuffer styleBuf= new StringBuffer(10 * styles.length); - for (String style : styles) { - styleBuf.append(" style=\""); //$NON-NLS-1$ - styleBuf.append(style); - styleBuf.append('"'); - } - - // Find insertion index - // a) within existing body tag with trailing space - int index= buffer.indexOf("<body "); //$NON-NLS-1$ - if (index != -1) { - buffer.insert(index+5, styleBuf); - return; - } - - // b) within existing body tag without attributes - index= buffer.indexOf("<body>"); //$NON-NLS-1$ - if (index != -1) { - buffer.insert(index+5, ' '); - buffer.insert(index+6, styleBuf); - return; - } - } - - /** - * - * @param buffer the output buffer * @param styleSheet the stylesheet * @param fgRGB Foreground-Color * @param bgRGB Background-Color @@ -401,33 +288,6 @@ public class HTMLPrinter { /** * * @param buffer the output buffer - * @param styleSheet the stylesheet - * @param fgRGB Foreground-Color - * @param bgRGB Background-Color - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - private static void appendStyleSheet(StringBuffer buffer, String styleSheet, RGB fgRGB, RGB bgRGB) { - if (styleSheet == null) - return; - - // workaround for https://bugs.eclipse.org/318243 - StringBuffer fg= new StringBuffer(); - appendColor(fg, fgRGB); - styleSheet= styleSheet.replaceAll("InfoText", fg.toString()); //$NON-NLS-1$ - StringBuilder bg= new StringBuilder(); - appendColor(bg, bgRGB); - styleSheet= styleSheet.replaceAll("InfoBackground", bg.toString()); //$NON-NLS-1$ - - buffer.append("<head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">"); //$NON-NLS-1$ - buffer.append(styleSheet); - buffer.append("</style></head>"); //$NON-NLS-1$ - } - - /** - * - * @param buffer the output buffer * @param styleSheetURL the URL to the Stylesheet * */ @@ -447,28 +307,6 @@ public class HTMLPrinter { /** * * @param buffer the output buffer - * @param styleSheetURL the URL to the Stylesheet - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - private static void appendStyleSheetURL(StringBuffer buffer, URL styleSheetURL) { - if (styleSheetURL == null) - return; - - buffer.append("<head>"); //$NON-NLS-1$ - - buffer.append("<LINK REL=\"stylesheet\" HREF= \""); //$NON-NLS-1$ - buffer.append(styleSheetURL); - buffer.append("\" CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">"); //$NON-NLS-1$ - - buffer.append("</head>"); //$NON-NLS-1$ - } - - - /** - * - * @param buffer the output buffer * @param position the offset * */ @@ -483,38 +321,6 @@ public class HTMLPrinter { * * @param buffer the output buffer * @param position the offset - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void insertPageProlog(StringBuffer buffer, int position) { - StringBuffer pageProlog= new StringBuffer(60); - pageProlog.append("<html>"); //$NON-NLS-1$ - appendColors(pageProlog, FG_COLOR_RGB, BG_COLOR_RGB); - buffer.insert(position, pageProlog.toString()); - } - - /** - * - * @param buffer the output buffer - * @param position the offset - * @param styleSheetURL URL to the Stylesheet - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void insertPageProlog(StringBuffer buffer, int position, URL styleSheetURL) { - StringBuffer pageProlog= new StringBuffer(300); - pageProlog.append("<html>"); //$NON-NLS-1$ - appendStyleSheetURL(pageProlog, styleSheetURL); - appendColors(pageProlog, FG_COLOR_RGB, BG_COLOR_RGB); - buffer.insert(position, pageProlog.toString()); - } - - /** - * - * @param buffer the output buffer - * @param position the offset * @param styleSheetURL URL to the Stylesheet * */ @@ -540,36 +346,12 @@ public class HTMLPrinter { /** * * @param buffer the output buffer - * @param position the offset - * @param styleSheet Stylesheet - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void insertPageProlog(StringBuffer buffer, int position, String styleSheet) { - insertPageProlog(buffer, position, null, null, styleSheet); - } - - /** - * - * @param buffer the output buffer * */ public static void addPageProlog(StringBuilder buffer) { insertPageProlog(buffer, buffer.length()); } - /** - * - * @param buffer the output buffer - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void addPageProlog(StringBuffer buffer) { - insertPageProlog(buffer, buffer.length()); - } - public static void addPageEpilog(StringBuilder buffer) { buffer.append("</body></html>"); //$NON-NLS-1$ } @@ -578,34 +360,12 @@ public class HTMLPrinter { * * @param buffer the output buffer * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void addPageEpilog(StringBuffer buffer) { - buffer.append("</body></html>"); //$NON-NLS-1$ - } - - /** - * - * @param buffer the output buffer - * */ public static void startBulletList(StringBuilder buffer) { buffer.append("<ul>"); //$NON-NLS-1$ } /** - * - * @param buffer the output buffer - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void startBulletList(StringBuffer buffer) { - buffer.append("<ul>"); //$NON-NLS-1$ - } - - /** * ends the bulletpointlist * * @param buffer the output buffer @@ -616,18 +376,6 @@ public class HTMLPrinter { } /** - * ends the bulletpointlist - * - * @param buffer the output buffer - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void endBulletList(StringBuffer buffer) { - buffer.append("</ul>"); //$NON-NLS-1$ - } - - /** * Adds bulletpoint * * @param buffer the output buffer @@ -643,23 +391,6 @@ public class HTMLPrinter { } /** - * Adds bulletpoint - * - * @param buffer the output buffer - * @param bullet the bulletpoint - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void addBullet(StringBuffer buffer, String bullet) { - if (bullet != null) { - buffer.append("<li>"); //$NON-NLS-1$ - buffer.append(bullet); - buffer.append("</li>"); //$NON-NLS-1$ - } - } - - /** * * Adds h5 headline * @@ -677,24 +408,6 @@ public class HTMLPrinter { /** * - * Adds h5 headline - * - * @param buffer the output buffer - * @param header of h5 headline - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void addSmallHeader(StringBuffer buffer, String header) { - if (header != null) { - buffer.append("<h5>"); //$NON-NLS-1$ - buffer.append(header); - buffer.append("</h5>"); //$NON-NLS-1$ - } - } - - /** - * * @param buffer the output buffer * @param paragraph the content of the paragraph * @@ -707,21 +420,6 @@ public class HTMLPrinter { } /** - * - * @param buffer the output buffer - * @param paragraph the content of the paragraph - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void addParagraph(StringBuffer buffer, String paragraph) { - if (paragraph != null) { - buffer.append("<p>"); //$NON-NLS-1$ - buffer.append(paragraph); - } - } - - /** * Appends a string and keeps its whitespace and newlines. * <p> * <b>Warning:</b> This starts a new paragraph when rendered in a browser, but @@ -744,31 +442,6 @@ public class HTMLPrinter { } /** - * Appends a string and keeps its whitespace and newlines. - * <p> - * <b>Warning:</b> This starts a new paragraph when rendered in a browser, but - * it doesn't starts a new paragraph when rendered with a {@link HTML2TextReader} - * (e.g. in a {@link DefaultInformationControl} that renders simple HTML). - * - * @param buffer the output buffer - * @param preFormatted the string that should be rendered with whitespace preserved - * - * @deprecated migrate to new StringBuilder API - * - * @see #convertToHTMLContent(String) - * @see #convertToHTMLContentWithWhitespace(String) - * @since 3.7 - */ - @Deprecated - public static void addPreFormatted(StringBuffer buffer, String preFormatted) { - if (preFormatted != null) { - buffer.append("<pre>"); //$NON-NLS-1$ - buffer.append(preFormatted); - buffer.append("</pre>"); //$NON-NLS-1$ - } - } - - /** * * @param buffer the output buffer * @param paragraphReader The content of the Read will be added to output buffer @@ -780,19 +453,6 @@ public class HTMLPrinter { } /** - * - * @param buffer the output buffer - * @param paragraphReader The content of the Read will be added to output buffer - * - * @deprecated migrate to new StringBuilder API - */ - @Deprecated - public static void addParagraph(StringBuffer buffer, Reader paragraphReader) { - if (paragraphReader != null) - addParagraph(buffer, read(paragraphReader)); - } - - /** * Replaces the following style attributes of the font definition of the <code>html</code> * element: * <ul> |