提交 fc1adc3a 编写于 作者: S serge-rider

UI theme change reflection was fixed (SQL editor + results viewer)

上级 2c54f357
......@@ -57,6 +57,7 @@ public abstract class AbstractPresentation implements IResultSetPresentation, IS
private final List<ISelectionChangedListener> selectionChangedListenerList = new ArrayList<>();
protected IThemeManager themeManager;
private IPropertyChangeListener themeChangeListener;
private long lastThemeUpdateTime;
@Override
@NotNull
......@@ -84,8 +85,15 @@ public abstract class AbstractPresentation implements IResultSetPresentation, IS
this.themeManager = controller.getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
this.themeChangeListener = event -> {
if (event.getProperty().startsWith(ThemeConstants.RESULTS_PROP_PREFIX)) {
applyThemeSettings();
if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME) ||
event.getProperty().startsWith(ThemeConstants.RESULTS_PROP_PREFIX))
{
if (lastThemeUpdateTime > 0 && System.currentTimeMillis() - lastThemeUpdateTime < 500) {
// Do not update too often (theme change may trigger this hundreds of times)
return;
}
lastThemeUpdateTime = System.currentTimeMillis();
UIUtils.asyncExec(this::applyThemeSettings);
}
};
this.themeManager.addPropertyChangeListener(themeChangeListener);
......
......@@ -123,9 +123,11 @@ public abstract class SQLEditorBase extends BaseTextEditor implements IErrorVisu
return;
}
lastUpdateTime = System.currentTimeMillis();
reloadSyntaxRules();
// Reconfigure to let comments/strings colors to take effect
getSourceViewer().configure(getSourceViewerConfiguration());
UIUtils.asyncExec(() -> {
reloadSyntaxRules();
// Reconfigure to let comments/strings colors to take effect
getSourceViewer().configure(getSourceViewerConfiguration());
});
}
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册