|
5 | 5 | import org.eclipse.swt.SWT; |
6 | 6 | import org.eclipse.swt.graphics.Color; |
7 | 7 | import org.eclipse.swt.graphics.Font; |
8 | | -import org.eclipse.swt.graphics.FontData; |
9 | 8 | import org.eclipse.swt.graphics.Image; |
10 | 9 | import org.eclipse.swt.graphics.Rectangle; |
11 | 10 | import org.eclipse.swt.layout.GridData; |
@@ -216,39 +215,25 @@ private boolean hasAnyPrice(CopilotModelBillingTokenPrices prices) { |
216 | 215 | } |
217 | 216 |
|
218 | 217 | private Font createBoldFont(Label label) { |
219 | | - Display display = label.getDisplay(); |
220 | | - FontData[] fontData = label.getFont().getFontData(); |
221 | | - for (FontData data : fontData) { |
222 | | - data.setStyle(SWT.BOLD); |
223 | | - } |
224 | | - Font boldFont = new Font(display, fontData); |
| 218 | + Font boldFont = UiUtils.getBoldFont(label.getDisplay(), label.getFont()); |
225 | 219 | label.addDisposeListener(event -> boldFont.dispose()); |
226 | 220 | return boldFont; |
227 | 221 | } |
228 | 222 |
|
229 | 223 | private void addWarningRow(Composite parent, String warningText) { |
230 | 224 | Label warningLabel = new Label(parent, SWT.WRAP); |
231 | 225 | warningLabel.setText(warningText); |
232 | | - setCssClass(warningLabel, POPUP_SECONDARY_TEXT_CLASS); |
| 226 | + UiUtils.applyCssClass(warningLabel, POPUP_SECONDARY_TEXT_CLASS, stylingEngine); |
233 | 227 | warningLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); |
234 | 228 | } |
235 | 229 |
|
236 | 230 | private Label createSecondaryTextLabel(Composite parent, String text) { |
237 | 231 | Label label = new Label(parent, SWT.NONE); |
238 | 232 | label.setText(text); |
239 | | - setCssClass(label, POPUP_SECONDARY_TEXT_CLASS); |
| 233 | + UiUtils.applyCssClass(label, POPUP_SECONDARY_TEXT_CLASS, stylingEngine); |
240 | 234 | return label; |
241 | 235 | } |
242 | 236 |
|
243 | | - private void setCssClass(Label control, String className) { |
244 | | - if (stylingEngine != null) { |
245 | | - stylingEngine.setClassname(control, className); |
246 | | - stylingEngine.style(control); |
247 | | - } else { |
248 | | - control.setData(CssConstants.CSS_CLASS_NAME_KEY, className); |
249 | | - } |
250 | | - } |
251 | | - |
252 | 237 | private void addSeparator(Composite parent) { |
253 | 238 | Composite separator = new Composite(parent, SWT.NONE); |
254 | 239 | GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); |
|
0 commit comments