Skip to content

Commit 6eab4cd

Browse files
committed
Update preference page in case the colors have been changed in a different page
1 parent 2171069 commit 6eab4cd

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaStackFramePreferencePage.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.jface.preference.ColorSelector;
2929
import org.eclipse.jface.preference.IPreferenceStore;
3030
import org.eclipse.jface.preference.PreferencePage;
31+
import org.eclipse.jface.util.IPropertyChangeListener;
3132
import org.eclipse.jface.util.PropertyChangeEvent;
3233
import org.eclipse.jface.viewers.IColorProvider;
3334
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -53,7 +54,7 @@
5354
*
5455
* @since 3.19
5556
*/
56-
public class JavaStackFramePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
57+
public class JavaStackFramePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPropertyChangeListener {
5758

5859
private static class CategoryColors {
5960
final IJavaStackFrame.Category category;
@@ -300,6 +301,7 @@ private void createAppearanceList(Composite container) {
300301
}
301302
});
302303

304+
303305
Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
304306
layout = new GridLayout();
305307
layout.marginHeight = 0;
@@ -329,6 +331,8 @@ private void createAppearanceList(Composite container) {
329331
fAppearanceList.update(selection, null);
330332
}
331333
});
334+
335+
PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().addListener(this);
332336
}
333337

334338
private CategoryColors getSelected() {
@@ -438,4 +442,18 @@ protected void performDefaults() {
438442
super.performDefaults();
439443
}
440444

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+
}
441459
}

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/StackFramePresentationProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,7 @@ public boolean isCollapseStackFrames() {
299299
return collapseStackFrames;
300300
}
301301

302+
static boolean isColorName(String propertyName) {
303+
return fgKeyMap.containsValue(propertyName) || bgKeyMap.containsValue(propertyName);
304+
}
302305
}

0 commit comments

Comments
 (0)