Skip to content

Commit 61c682d

Browse files
committed
Update Color constructors to modern signature
Follows eclipse-platform/eclipse.platform.swt#3232 by removing the Device/Display argument from Color constructors.
1 parent f22f75c commit 61c682d

47 files changed

Lines changed: 142 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTColorHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class CSSSWTColorHelper {
5454

5555
public static Color getSWTColor(RGBColor rgbColor, Display display) {
5656
RGBA rgb = getRGBA(rgbColor);
57-
return new Color(display, rgb);
57+
return new Color(rgb);
5858
}
5959

6060
public static Color getSWTColor(CSSValue value, Display display) {
@@ -64,7 +64,7 @@ public static Color getSWTColor(CSSValue value, Display display) {
6464
Color color = display.getSystemColor(SWT.COLOR_BLACK);
6565
RGBA rgba = getRGBA((CSSPrimitiveValue) value, display);
6666
if (rgba != null) {
67-
color = new Color(display, rgba.rgb.red, rgba.rgb.green, rgba.rgb.blue, rgba.alpha);
67+
color = new Color(rgba.rgb.red, rgba.rgb.green, rgba.rgb.blue, rgba.alpha);
6868
}
6969
return color;
7070
}

bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ public void handleEvent(Event event) {
157157
List<Color> colors = new ArrayList<>();
158158
for (Object rgbObj : grad.getRGBs()) {
159159
if (rgbObj instanceof RGBA rgba) {
160-
Color color = new Color(control.getDisplay(), rgba);
160+
Color color = new Color(rgba);
161161
colors.add(color);
162162
} else if (rgbObj instanceof RGB rgb) {
163-
Color color = new Color(control.getDisplay(), rgb);
163+
Color color = new Color(rgb);
164164
colors.add(color);
165165
}
166166
}

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds) {
411411
if (!active && !onBottom) {
412412
RGB blendColor = gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW).getRGB();
413413
RGB topGradient = blend(blendColor, tabOutlineColor.getRGB(), 40);
414-
gradientLineTop = new Color(gc.getDevice(), topGradient);
414+
gradientLineTop = new Color(topGradient);
415415
foregroundPattern = new Pattern(gc.getDevice(), 0, 0, 0, bounds.height + 1, gradientLineTop,
416416
gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
417417
gc.setForegroundPattern(foregroundPattern);

bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/CSSRenderingUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private Image rotateImage(Display display, Image image, Integer[] frameInts) {
166166
Image rotatedImage = new Image(display, imageData);
167167
GC gc = new GC(rotatedImage);
168168
RGB rgb = new RGB(0x7d, 0, 0);
169-
Color offRed = new Color(display, rgb);
169+
Color offRed = new Color(rgb);
170170
gc.setBackground(offRed);
171171
gc.fillRectangle(0, 0, bounds.height, bounds.width);
172172
Transform t = new Transform(display);

bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void keyReleased(KeyEvent e) {}
168168
GridData gd2= new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
169169
fStatusField.setLayoutData(gd2);
170170

171-
Color statusTextForegroundColor= new Color(fStatusField.getDisplay(),
171+
Color statusTextForegroundColor= new Color(
172172
blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f));
173173
fStatusField.setForeground(statusTextForegroundColor);
174174

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ private void setStatusLabelColors(Color foreground, Color background) {
655655
if (foreground == null || background == null) {
656656
return;
657657
}
658-
Color statusLabelForeground= new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
658+
Color statusLabelForeground= new Color(Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
659659
fStatusLabel.setForeground(statusLabelForeground);
660660
fStatusLabel.setBackground(background);
661661
}

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public void install(ITextViewer textViewer) {
180180
} else if (fRGB != null) {
181181
StyledText text= fTextViewer.getTextWidget();
182182
if (text != null && !text.isDisposed()) {
183-
fColor= new Color(text.getDisplay(), fRGB);
183+
fColor= new Color(fRGB);
184184
}
185185
}
186186
}
@@ -349,7 +349,7 @@ private Color createColorFromPreferenceStore() {
349349
}
350350

351351
if (rgb != null) {
352-
return new Color(textWidget.getDisplay(), rgb);
352+
return new Color(rgb);
353353
}
354354
}
355355

@@ -372,3 +372,6 @@ public void propertyChange(PropertyChangeEvent event) {
372372
}
373373
}
374374
}
375+
376+
}
377+
}

bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,6 @@ protected Control createInfoTextArea(Composite parent) {
876876

877877
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL,
878878
SWT.BEGINNING).applyTo(infoLabel);
879-
Display display = parent.getDisplay();
880879

881880
Color backgroundColor = getBackground();
882881
if (backgroundColor == null) {
@@ -886,7 +885,7 @@ protected Control createInfoTextArea(Composite parent) {
886885
if (foregroundColor == null) {
887886
foregroundColor = getDefaultForeground();
888887
}
889-
Color infoColor = new Color(display, blend(
888+
Color infoColor = new Color(blend(
890889
backgroundColor.getRGB(), foregroundColor.getRGB(),
891890
0.56f));
892891

bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private Control createTitleArea(Composite parent) {
222222
Color background;
223223
Color foreground;
224224
if (titleAreaRGB != null) {
225-
titleAreaColor = new Color(display, titleAreaRGB);
225+
titleAreaColor = new Color(titleAreaRGB);
226226
background = titleAreaColor;
227227
foreground = null;
228228
} else {

bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/FieldAssistColors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public static Color getRequiredFieldBackgroundColor(Control control) {
141141
destBlue += (src.getBlue() - destBlue) * alpha / 0xFF;
142142

143143
// create the color
144-
Color color = new Color(display, destRed, destGreen, destBlue);
144+
Color color = new Color(destRed, destGreen, destBlue);
145145
// record the color in a map using the original color as the key
146146
requiredFieldColorMap.put(dest, color);
147147
// If we have never created a color on this display before, install

0 commit comments

Comments
 (0)