|
28 | 28 | import org.eclipse.jface.preference.ColorSelector; |
29 | 29 | import org.eclipse.jface.preference.IPreferenceStore; |
30 | 30 | import org.eclipse.jface.preference.PreferencePage; |
| 31 | +import org.eclipse.jface.util.IPropertyChangeListener; |
31 | 32 | import org.eclipse.jface.util.PropertyChangeEvent; |
32 | 33 | import org.eclipse.jface.viewers.IColorProvider; |
33 | 34 | import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
53 | 54 | * |
54 | 55 | * @since 3.19 |
55 | 56 | */ |
56 | | -public class JavaStackFramePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { |
| 57 | +public class JavaStackFramePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPropertyChangeListener { |
57 | 58 |
|
58 | 59 | private static class CategoryColors { |
59 | 60 | final IJavaStackFrame.Category category; |
@@ -300,6 +301,7 @@ private void createAppearanceList(Composite container) { |
300 | 301 | } |
301 | 302 | }); |
302 | 303 |
|
| 304 | + |
303 | 305 | Composite stylesComposite = new Composite(editorComposite, SWT.NONE); |
304 | 306 | layout = new GridLayout(); |
305 | 307 | layout.marginHeight = 0; |
@@ -329,6 +331,8 @@ private void createAppearanceList(Composite container) { |
329 | 331 | fAppearanceList.update(selection, null); |
330 | 332 | } |
331 | 333 | }); |
| 334 | + |
| 335 | + PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().addListener(this); |
332 | 336 | } |
333 | 337 |
|
334 | 338 | private CategoryColors getSelected() { |
@@ -438,4 +442,18 @@ protected void performDefaults() { |
438 | 442 | super.performDefaults(); |
439 | 443 | } |
440 | 444 |
|
| 445 | + @Override |
| 446 | + public void propertyChange(PropertyChangeEvent event) { |
| 447 | + var propertyName = event.getProperty(); |
| 448 | + if (StackFramePresentationProvider.isColorName(propertyName)) { |
| 449 | + fAppearanceList.update(colors.toArray(), null); |
| 450 | + fAppearanceList.setSelection(new StructuredSelection(colors.get(0))); |
| 451 | + } |
| 452 | + } |
| 453 | + |
| 454 | + @Override |
| 455 | + public void dispose() { |
| 456 | + PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().removeListener(this); |
| 457 | + super.dispose(); |
| 458 | + } |
441 | 459 | } |
0 commit comments