Professional Documents
Culture Documents
2012 EclipseCon CSS PDF
2012 EclipseCon CSS PDF
Platform
Brian de Alwis
Manumitting Technologies
bsd@mt.ca
2
Tuesday, 27 March, 12
Eclipse 4 goal:
make writing plugins easy
Eclipse 4 goal:
make writing plugins easy
Allow better control over the look of
Eclipse-based products
Eclipse 4 goal:
make writing plugins easy
Allow better control over the look of
Eclipse-based products
Let those who can, do
4
Tuesday, 27 March, 12
5
Tuesday, 27 March, 12
5
Tuesday, 27 March, 12
CSS
5
Tuesday, 27 March, 12
html
body
div
div
h1 p p img p
em
HTML
6
Tuesday, 27 March, 12
html
Shell
body
Composite
div
div
Composite
Composite
h1 p p img p
em
Table
HTML
SWT
6
Tuesday, 27 March, 12
7
Tuesday, 27 March, 12
8
Tuesday, 27 March, 12
CSS on SWT
10
Tuesday, 27 March, 12
CSS Rules
h1
{ color: red; }
11
Tuesday, 27 March, 12
11
Tuesday, 27 March, 12
11
Tuesday, 27 March, 12
11
Tuesday, 27 March, 12
getClass() == h1
instanceof
==
11
Tuesday, 27 March, 12
Composite#f2
Text Table Combo
12
Composite
Composite.MArea
CTabFolder.EditorStack
CTabItem.Editor CTabItem.Editor
Composite#f1
Group Text
Table#serverList
Tuesday, 27 March, 12
Composite#f2
Text Table Combo
13
Composite
Composite.MArea
Composite.MArea
CTabFolder.EditorStack
CTabItem.Editor CTabItem.Editor
Composite#f1
Group Text
Table#serverList
Tuesday, 27 March, 12
Composite#f2
Text Table Combo
14
Composite
Composite.MArea
Composite.MArea
CTabFolder.EditorStack
CTabItem.Editor CTabItem.Editor
Composite#f2
Composite#f1
Group Text
Table#serverList
Tuesday, 27 March, 12
Composite#f2
Text Table Combo
15
Compound Selectors
Shell.MTrimmedWindow
Text
CTabFolder.EditorStack
CTabItem
CTabItem
Child Selectors
.MTrimmedWindow > Text
Shell.MTrimmedWindow
Text
CTabFolder.EditorStack
CTabItem
CTabItem
Descendant Selectors
.MTrimmedWindow Text
Shell.MTrimmedWindow
Text
CTabFolder.EditorStack
CTabItem
CTabItem
Descendant Selectors
.MTrimmedWindow Text
Shell
Shell.MTrimmedWindow
Text
Text
CTabFolder.EditorStack
CTabItem
CTabItem
Attribute Selectors
Button[style~=SWT.CHECK]
Widget.class
Exact value
~=
Partial value
Widget[class~=class]
19
Tuesday, 27 March, 12
21
Tuesday, 27 March, 12
Exposing Information
Leveraging the CSS for your own widgets
22
Tuesday, 27 March, 12
23
Identifying Widgets
E4 exposes SWT widgets too: type#id.class
type corresponds to the widget class
#id matches an object's elementId 'id' (with '.'
translated to '-')
.class matches against the modelled element type, any
tags on the modelled element, style bits, and widget
data key-value items
24
WidgetElement.setCSSClass(
widget, class string);
Widgets
Defines:
Local + package
name
Provides:
Attributes
DOM Elements
ElementAdapter
ControlElement
ItemElement
CTabItemElement
CompositeElement
ShellElement
Pseudo elements
26
Tuesday, 27 March, 12
<extension point="org.eclipse.e4.ui.css.core.elementProvider">
<provider
class="org.eclipse.e4.ui.css.swt.dom.SWTElementProvider">
<widget class="org.eclipse.swt.widgets.Control" />
<widget class="org.eclipse.swt.widgets.Composite" />
<widget class="org.eclipse.swt.widgets.Button" />
</provider>
</extension>
27
Tuesday, 27 March, 12
28
Tuesday, 27 March, 12
29
Tuesday, 27 March, 12
Pitfalls
30
Tuesday, 27 March, 12
Composite.getBackgroundMode()
SWT.INHERIT_NONE
Tuesday, 27 March, 12
31
Composite.getBackgroundMode()
SWT.INHERIT_DEFAULT
Tuesday, 27 March, 12
32
33
Tuesday, 27 March, 12
34
Tuesday, 27 March, 12
Specificity
Cascades
34
Tuesday, 27 March, 12
35
How to use CSS for setting fonts and colours for label
providers?
36
Best Practices
38
Tuesday, 27 March, 12
Best practices
Identify rules for labeling/identifying structure
Scoping
SWT Quirks
background mode
background image & background colour
(Lack of) support for non-px dimensions
39
Scoping
Text {
color: white;
background-color: black;
}
40
Tuesday, 27 March, 12
Scoping
Text {
color: white;
background-color: black;
}
Affects Text instances everywhere.
Including startup dialogs.
40
Tuesday, 27 March, 12
Scoping
.MTrimmedWindow Text,
.MWindow
Text { Text {
color:
color: white;
white;
background-color:
background-color: black;
black;
}}
40
Tuesday, 27 March, 12
41
Tuesday, 27 March, 12
42
43
44
Resources
E4 docs: http://wiki.eclipse.org/Eclipse4/RCP
e4 forum and mailing list
45
Thank you!
46
Pre-emptive Questions
47
Tuesday, 27 March, 12
?
48
Tuesday, 27 March, 12