Is it possible to apply CSS styles to a dialogue or wizard modal window in Eclipse?

瘦欲@ 提交于 2021-01-28 01:32:34

问题


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: enter image description here




回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!