Skip to content

Commit 1859f52

Browse files
Rob Strykermickaelistria
authored andcommitted
Updates as per maintainer request
Signed-off-by: Rob Stryker <[email protected]>
1 parent d202b08 commit 1859f52

File tree

5 files changed

+36
-35
lines changed

5 files changed

+36
-35
lines changed

bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
import org.eclipse.swt.graphics.RGB;
2424
import org.eclipse.swt.widgets.Display;
2525

26-
import org.eclipse.text.html.CoreHTMLPrinter;
27-
import org.eclipse.text.html.CoreRGB;
26+
import org.eclipse.text.html.BaseHTMLPrinter;
2827

2928
import org.eclipse.jface.resource.JFaceColors;
3029
import org.eclipse.jface.resource.JFaceResources;
@@ -37,7 +36,7 @@
3736
* Moved into this package from <code>org.eclipse.jface.internal.text.revisions</code>.</p>
3837
*/
3938
public class HTMLPrinter {
40-
private static final CoreHTMLPrinter CORE= new CoreHTMLPrinter();
39+
private static final BaseHTMLPrinter CORE= new BaseHTMLPrinter();
4140

4241
static {
4342
final Display display= Display.getDefault();
@@ -63,16 +62,16 @@ private static void installColorUpdater(final Display display) {
6362
JFaceResources.getColorRegistry().addListener(event -> cacheColors(display));
6463
}
6564

66-
private static CoreRGB fromRGB(RGB val) {
67-
return new CoreRGB(val.red, val.green, val.blue);
65+
private static org.eclipse.text.html.RGB fromRGB(RGB val) {
66+
return new org.eclipse.text.html.RGB(val.red, val.green, val.blue);
6867
}
6968
private static void cacheColors(Display display) {
70-
CoreRGB bg= fromRGB(JFaceColors.getInformationViewerBackgroundColor(display).getRGB());
71-
CoreRGB fg= fromRGB(JFaceColors.getInformationViewerForegroundColor(display).getRGB());
69+
org.eclipse.text.html.RGB bg= fromRGB(JFaceColors.getInformationViewerBackgroundColor(display).getRGB());
70+
org.eclipse.text.html.RGB fg= fromRGB(JFaceColors.getInformationViewerForegroundColor(display).getRGB());
7271
Color hyperlinkText= JFaceColors.getHyperlinkText(display);
7372
Color activeHyperlinkText= JFaceColors.getActiveHyperlinkText(display);
74-
CoreRGB link= hyperlinkText == null ? null : fromRGB(hyperlinkText.getRGB());
75-
CoreRGB alink= activeHyperlinkText == null ? null : fromRGB(activeHyperlinkText.getRGB());
73+
org.eclipse.text.html.RGB link= hyperlinkText == null ? null : fromRGB(hyperlinkText.getRGB());
74+
org.eclipse.text.html.RGB alink= activeHyperlinkText == null ? null : fromRGB(activeHyperlinkText.getRGB());
7675
CORE.setColors(bg, fg, link, alink);
7776
}
7877

@@ -88,7 +87,7 @@ private static void cacheColors(Display display) {
8887
* @see #addPreFormatted(StringBuilder, String) for rendering with an {@link HTML2TextReader}
8988
*/
9089
public static String convertToHTMLContent(String content) {
91-
return CoreHTMLPrinter.convertToHTMLContent(content);
90+
return BaseHTMLPrinter.convertToHTMLContent(content);
9291
}
9392

9493
/**
@@ -107,11 +106,11 @@ public static String convertToHTMLContent(String content) {
107106
* @since 3.7
108107
*/
109108
public static String convertToHTMLContentWithWhitespace(String content) {
110-
return CoreHTMLPrinter.convertToHTMLContentWithWhitespace(content);
109+
return BaseHTMLPrinter.convertToHTMLContentWithWhitespace(content);
111110
}
112111

113112
public static String read(Reader rd) {
114-
return CoreHTMLPrinter.read(rd);
113+
return BaseHTMLPrinter.read(rd);
115114
}
116115

117116
/**
@@ -478,6 +477,6 @@ private static void runOp(StringBuffer buffer, BuilderBuffer bf) {
478477
public static String convertTopLevelFont(String styles, FontData fontData) {
479478
boolean bold= (fontData.getStyle() & SWT.BOLD) != 0;
480479
boolean italic= (fontData.getStyle() & SWT.ITALIC) != 0;
481-
return CoreHTMLPrinter.convertTopLevelFont(styles, bold, italic, fontData.getHeight(), fontData.getName());
480+
return BaseHTMLPrinter.convertTopLevelFont(styles, bold, italic, fontData.getHeight(), fontData.getName());
482481
}
483482
}

bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/SingleCharReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
* @deprecated Please use SingleCharacterReader
2424
*/
25+
@Deprecated
2526
public abstract class SingleCharReader extends SingleCharacterReader {
2627

2728
}

bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/SubstitutionTextReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Moved into this package from <code>org.eclipse.jface.internal.text.revisions</code>.</p>
2626
* @deprecated Please use org.eclipse.text.readers.SubstitutionReader
2727
*/
28+
@Deprecated
2829
public abstract class SubstitutionTextReader extends SingleCharReader {
2930

3031
protected static final String LINE_DELIM= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$

bundles/org.eclipse.text/src/org/eclipse/text/html/CoreHTMLPrinter.java renamed to bundles/org.eclipse.text/src/org/eclipse/text/html/BaseHTMLPrinter.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,33 @@
2626
*
2727
* @since 3.14
2828
*/
29-
public class CoreHTMLPrinter {
29+
public class BaseHTMLPrinter {
3030

31-
private static volatile CoreRGB DEFAULT_BG_COLOR_RGB= new CoreRGB(255, 255, 225); // CoreRGB value of info bg color on WindowsXP
32-
private static volatile CoreRGB DEFAULT_FG_COLOR_RGB= new CoreRGB(0, 0, 0); // CoreRGB value of info fg color on WindowsXP
33-
private static volatile CoreRGB DEFAULT_LINK_COLOR_RGB= new CoreRGB(0, 0, 255); // dark blue
34-
private static volatile CoreRGB DEFAULT_ACTIVE_LINK_COLOR_RGB= new CoreRGB(0, 0, 128); // light blue
31+
private static volatile RGB DEFAULT_BG_COLOR_RGB= new RGB(255, 255, 225); // CoreRGB value of info bg color on WindowsXP
32+
private static volatile RGB DEFAULT_FG_COLOR_RGB= new RGB(0, 0, 0); // CoreRGB value of info fg color on WindowsXP
33+
private static volatile RGB DEFAULT_LINK_COLOR_RGB= new RGB(0, 0, 255); // dark blue
34+
private static volatile RGB DEFAULT_ACTIVE_LINK_COLOR_RGB= new RGB(0, 0, 128); // light blue
3535

3636
private static final String UNIT; // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=155993
3737
static {
3838
UNIT= Platform.OS.isMac() ? "px" : "pt"; //$NON-NLS-1$//$NON-NLS-2$
3939
}
4040

4141

42-
private CoreRGB bgColor;
43-
private CoreRGB fgColor;
44-
private CoreRGB linkColor;
45-
private CoreRGB alinkColor;
42+
private RGB bgColor;
43+
private RGB fgColor;
44+
private RGB linkColor;
45+
private RGB alinkColor;
4646

47-
public CoreHTMLPrinter() {
47+
public BaseHTMLPrinter() {
4848
this(DEFAULT_BG_COLOR_RGB, DEFAULT_FG_COLOR_RGB, DEFAULT_LINK_COLOR_RGB, DEFAULT_ACTIVE_LINK_COLOR_RGB);
4949
}
5050

51-
public CoreHTMLPrinter(CoreRGB bg, CoreRGB fg, CoreRGB link, CoreRGB alink) {
51+
public BaseHTMLPrinter(RGB bg, RGB fg, RGB link, RGB alink) {
5252
setColors(bg, fg, link, alink);
5353
}
5454

55-
public void setColors(CoreRGB bg, CoreRGB fg, CoreRGB link, CoreRGB alink) {
55+
public void setColors(RGB bg, RGB fg, RGB link, RGB alink) {
5656
this.bgColor = bg;
5757
this.fgColor = fg;
5858
this.linkColor = link;
@@ -139,7 +139,7 @@ public static String read(Reader rd) {
139139
* @param bgRGB Background-Color
140140
* @param styleSheet Stylesheet
141141
*/
142-
public void insertPageProlog(StringBuilder buffer, int position, CoreRGB fgRGB, CoreRGB bgRGB, String styleSheet) {
142+
public void insertPageProlog(StringBuilder buffer, int position, RGB fgRGB, RGB bgRGB, String styleSheet) {
143143
if (fgRGB == null)
144144
fgRGB= this.fgColor;
145145
if (bgRGB == null)
@@ -164,7 +164,7 @@ public void insertPageProlog(StringBuilder buffer, int position, CoreRGB fgRGB,
164164
* @param bgRGB Background-Color
165165
*
166166
*/
167-
private void appendColors(StringBuilder pageProlog, CoreRGB fgRGB, CoreRGB bgRGB) {
167+
private void appendColors(StringBuilder pageProlog, RGB fgRGB, RGB bgRGB) {
168168
pageProlog.append("<body text=\""); //$NON-NLS-1$
169169
appendColor(pageProlog, fgRGB);
170170
pageProlog.append("\" bgcolor=\""); //$NON-NLS-1$
@@ -179,7 +179,7 @@ private void appendColors(StringBuilder pageProlog, CoreRGB fgRGB, CoreRGB bgRGB
179179
* @param rgb RGB-Value
180180
*
181181
*/
182-
private void appendColor(StringBuilder buffer, CoreRGB rgb) {
182+
private void appendColor(StringBuilder buffer, RGB rgb) {
183183
buffer.append('#');
184184
appendAsHexString(buffer, rgb.red);
185185
appendAsHexString(buffer, rgb.green);
@@ -241,7 +241,7 @@ public void insertStyles(StringBuilder buffer, String[] styles) {
241241
* @param bgRGB Background-Color
242242
*
243243
*/
244-
private void appendStyleSheet(StringBuilder buffer, String styleSheet, CoreRGB fgRGB, CoreRGB bgRGB) {
244+
private void appendStyleSheet(StringBuilder buffer, String styleSheet, RGB fgRGB, RGB bgRGB) {
245245
if (styleSheet == null)
246246
return;
247247

bundles/org.eclipse.text/src/org/eclipse/text/html/CoreRGB.java renamed to bundles/org.eclipse.text/src/org/eclipse/text/html/RGB.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @since 3.14
3737
*/
3838

39-
public final class CoreRGB implements Serializable {
39+
public final class RGB implements Serializable {
4040

4141
/**
4242
* the red component of the RGB
@@ -67,7 +67,7 @@ public final class CoreRGB implements Serializable {
6767
* <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
6868
* </ul>
6969
*/
70-
public CoreRGB(int red, int green, int blue) {
70+
public RGB(int red, int green, int blue) {
7171
if ((red > 255) || (red < 0) ||
7272
(green > 255) || (green < 0) ||
7373
(blue > 255) || (blue < 0))
@@ -90,9 +90,9 @@ public CoreRGB(int red, int green, int blue) {
9090
* the saturation or brightness is not between 0 and 1</li>
9191
* </ul>
9292
*
93-
* @since 3.2
93+
* @since 3.14
9494
*/
95-
public CoreRGB(float hue, float saturation, float brightness) {
95+
public RGB(float hue, float saturation, float brightness) {
9696
if (hue < 0 || hue > 360 || saturation < 0 || saturation > 1 ||
9797
brightness < 0 || brightness > 1) {
9898
throw new IllegalArgumentException("Argument not valid"); //$NON-NLS-1$
@@ -157,7 +157,7 @@ public CoreRGB(float hue, float saturation, float brightness) {
157157
* </ul>
158158
* @see #RGB(float, float, float)
159159
*
160-
* @since 3.2
160+
* @since 3.14
161161
*/
162162
public float[] getHSB() {
163163
float r = red / 255f;
@@ -198,7 +198,7 @@ public float[] getHSB() {
198198
@Override
199199
public boolean equals(Object object) {
200200
if (object == this) return true;
201-
if (!(object instanceof CoreRGB rgb)) return false;
201+
if (!(object instanceof RGB rgb)) return false;
202202
return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
203203
}
204204

0 commit comments

Comments
 (0)