问题
Is it possible to apply CSS styles to a dialogue or wizard modal window in Eclipse? I've been able to use the CSS Spy plug-in to figure out most elements but when I bring a modal up, Spy becomes inactive.
回答1:
Yes it is possible for dialogs and wizards that you create. However changing some of the styles of a dialog or wizard can be quite tricky (such as the dialog background). To some extent you can also apply styles to existing dialogs.
For dialogs you create you probably want to set a CSS class for the dialog area to make it easier to specify styles applying just to the dialog:
@Override
protected Control createDialogArea(final Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
WidgetElement.setCSSClass(composite, "DialogClass");
...
This sets the CSS class and the composite background mode.
You can also apply styles to any dialog using CSS selectors in the form:
Shell[style~='SWT.APPLICATION_MODAL'] > Composite > Text
{
font-size: 14pt;
}
which applies the style to a Text control in a application model dialog.
An example Dialog
with styling:
回答2:
No. The CSS styling feature works on Eclipse 4 workbench model which represents the workbench window along with editors and views within it, but not the content of editors, views or dialogs.
来源:https://stackoverflow.com/questions/28707822/is-it-possible-to-apply-css-styles-to-a-dialogue-or-wizard-modal-window-in-eclip