Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-incubator-e4-dev] CSS namespaces

Hi Kevin,

see my comment below:

Kevin McGuire wrote:

 > Hi,
 > Angelo brought up CSS namespaces, I think this is an important topic
 > that hasn't been discussed here yet.

Sigh... yes.

 > The question is how to specify
 > custom widget types in CSS. With SWT, the widget names are unambiguous,
 > but custom widgets can involve name collisions.
 > Using CSS namespaces would be an option, although I would then opt for
 > using a default namespace for SWT to avoid clutter. The CSS could look
 > like this:
 >    @namespace "org.eclipse.swt.widgets";
 >    @namespace my "";
 >    Label {
 >      color;red;
 >    }
 >    my|Label {
 >      color;red;
 >    }
 > On the other hand, some frequently used SWT widgets live in
 > "org.eclipse.swt.custom" (CLabel, CCombo, CTabFolder, ...), so those
 > would have to be prefixed as well (which I somehow dislike):
 >    swtcustom|CLabel {
 >      color: blue;
 >    }

Agree, I dislike it too. It's annoying to clutter the typical case (SWT widgets, regardless of whether they are custom or not).

 > Moreover, CSS 3 is not yet widely adopted and the available parsers do
 > not support it out-of-the-box.

Good point.
> An alternative to CSS namespaces could be some kind of mapping between
 > widget classes and CSS element names.

I think this is a reasonable approach. Extended widgets outside of SWT would need some form of qualified name, not so much to prevent clashing with SWT since presumably everyone avoids that, but to prevent clashing with each other. The element names can be whatever we want them to be, since its our code that'll do the mapping from CSS to widget method calls. So we could solve it without resorting to CSS name spaces, for example by requiring that extended widgets register their names with us in some qualified fashion (e.g. NebulaGallery). Kinda hacky but would work.

Yes, that's also our preferred approach. In RAP we have an extension point for themeable widgets anyway (the RAP theming has to know about themeable widgets to keep styling and layout in sync between client and server). This is also a suitable place to register such an element name. I'm not sure whether such an extension point would also be appropriate for Eclipse in general. Who would have to register with such an extension point? The component provider, e.g. Nebula?




eclipse-incubator-e4-dev mailing list

Dipl.-Inform. Ralf Sternberg
Innoopract Informationssysteme GmbH
Tel:  0721 - 66 47 33 - 0
Fax: 0721 - 66 47 33 29

========================= Legal Disclaimer ==========================
According to Section 80 of the German Corporation Act Innoopract
Informationssysteme GmbH must indicate the following information:
Address: Stephanienstrasse 20, 76133 Karlsruhe Germany
General Manager: Jochen Krause
Registered Office: Karlsruhe, Commercial Register Mannheim HRB 107883

Back to the top