Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 263181
Collapse All | Expand All

(-)src/org/eclipse/e4/ui/tests/css/swt/CTabFolderTest.java (-1 / +123 lines)
Lines 4-9 Link Here
4
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.SWT;
5
import org.eclipse.swt.custom.CTabFolder;
5
import org.eclipse.swt.custom.CTabFolder;
6
import org.eclipse.swt.custom.CTabItem;
6
import org.eclipse.swt.custom.CTabItem;
7
import org.eclipse.swt.graphics.FontData;
7
import org.eclipse.swt.graphics.RGB;
8
import org.eclipse.swt.graphics.RGB;
8
import org.eclipse.swt.layout.FillLayout;
9
import org.eclipse.swt.layout.FillLayout;
9
import org.eclipse.swt.widgets.Composite;
10
import org.eclipse.swt.widgets.Composite;
Lines 30-42 Link Here
30
31
31
		CTabFolder folderToTest = new CTabFolder(panel, SWT.NONE);
32
		CTabFolder folderToTest = new CTabFolder(panel, SWT.NONE);
32
		CTabItem tab1 = new CTabItem(folderToTest, SWT.NONE);
33
		CTabItem tab1 = new CTabItem(folderToTest, SWT.NONE);
33
		tab1.setText("A TAB ITEM");
34
		
34
		
35
		engine.applyStyles(shell, true);
35
		engine.applyStyles(shell, true);
36
36
37
		shell.pack();
37
		shell.pack();
38
		shell.open();
38
		shell.open();
39
		return folderToTest;
39
		return folderToTest;
40
		
41
		
40
	}
42
	}
41
	
43
	
42
	public void testBackgroundColor() throws Exception {
44
	public void testBackgroundColor() throws Exception {
Lines 50-55 Link Here
50
		assertEquals(BLUE, folderToTest.getForeground().getRGB());
52
		assertEquals(BLUE, folderToTest.getForeground().getRGB());
51
		folderToTest.getShell().close();
53
		folderToTest.getShell().close();
52
	}
54
	}
55
	
56
	public void testFontRegular() throws Exception {
57
		CTabFolder folderToTest = createTestCTabFolder("Label { font: Verdana 16px }");
58
		assertEquals(1, folderToTest.getFont().getFontData().length);
59
		FontData fontData = folderToTest.getFont().getFontData()[0];
60
		assertEquals("Verdana", fontData.getName());
61
		assertEquals(16, fontData.getHeight());
62
		assertEquals(SWT.NORMAL, fontData.getStyle());		
63
		folderToTest.getShell().close();
64
	}
65
66
	public void testFontBold() throws Exception {
67
		CTabFolder folderToTest = createTestCTabFolder("Label { font: Arial 12px; font-weight: bold }");
68
		assertEquals(1, folderToTest.getFont().getFontData().length);
69
		FontData fontData = folderToTest.getFont().getFontData()[0];
70
		assertEquals("Arial", fontData.getName());
71
		assertEquals(12, fontData.getHeight());
72
		assertEquals(SWT.BOLD, fontData.getStyle());		
73
		folderToTest.getShell().close();
74
	}
75
76
	public void testFontItalic() throws Exception {
77
		CTabFolder folderToTest = createTestCTabFolder("Label { font: Arial 12px; font-style: italic }");
78
		assertEquals(1, folderToTest.getFont().getFontData().length);
79
		FontData fontData = folderToTest.getFont().getFontData()[0];
80
		assertEquals("Arial", fontData.getName());
81
		assertEquals(12, fontData.getHeight());
82
		assertEquals(SWT.ITALIC, fontData.getStyle());		
83
		folderToTest.getShell().close();
84
	}
53
85
54
//	public void testGradientColor() throws Exception {
86
//	public void testGradientColor() throws Exception {
55
//		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { background-color: #FF0000  #0000FF }");
87
//		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { background-color: #FF0000  #0000FF }");
Lines 67-70 Link Here
67
		assertEquals(GREEN, folderToTest.getSelectionBackground().getRGB());
99
		assertEquals(GREEN, folderToTest.getSelectionBackground().getRGB());
68
		folderToTest.getShell().close();
100
		folderToTest.getShell().close();
69
	}
101
	}
102
	
103
	public void testBorderVisible() throws Exception {
104
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { borderVisible: true}");
105
		assertEquals(true, folderToTest.getBorderVisible());
106
		folderToTest.getShell().close();
107
		folderToTest = createTestCTabFolder("CTabFolder { borderVisible: false}");
108
		assertEquals(false, folderToTest.getBorderVisible());
109
		folderToTest.getShell().close();
110
	}
111
	
112
	public void testSimple() throws Exception {
113
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { simple: true}");
114
		assertEquals(true, folderToTest.getSimple());
115
		folderToTest.getShell().close();
116
		folderToTest = createTestCTabFolder("CTabFolder { simple: false}");
117
		assertEquals(false, folderToTest.getSimple());
118
		folderToTest.getShell().close();
119
	}
120
	
121
	public void testMaximizeVisible() throws Exception {
122
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { maximizeVisible: true}");
123
		assertEquals(true, folderToTest.getMaximizeVisible());
124
		folderToTest.getShell().close();
125
		folderToTest = createTestCTabFolder("CTabFolder { maximizeVisible: false}");
126
		assertEquals(false, folderToTest.getMaximizeVisible());
127
		folderToTest.getShell().close();
128
	}
129
	
130
	public void testMinimizeVisible() throws Exception {
131
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { minimizeVisible: true}");
132
		assertEquals(true, folderToTest.getMinimizeVisible());
133
		folderToTest.getShell().close();
134
		folderToTest = createTestCTabFolder("CTabFolder { minimizeVisible: false}");
135
		assertEquals(false, folderToTest.getMinimizeVisible());
136
		folderToTest.getShell().close();
137
	}
138
	
139
	public void testMRUVisible() throws Exception {
140
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { mruVisible: true}");
141
		assertEquals(true, folderToTest.getMRUVisible());
142
		folderToTest.getShell().close();
143
		folderToTest = createTestCTabFolder("CTabFolder { mruVisible: false}");
144
		assertEquals(false, folderToTest.getMRUVisible());
145
		folderToTest.getShell().close();
146
	}
147
	
148
	public void testMaximized() throws Exception {
149
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { maximized: true}");
150
		assertEquals(true, folderToTest.getMaximized());
151
		folderToTest.getShell().close();
152
		folderToTest = createTestCTabFolder("CTabFolder { maximized: false}");
153
		assertEquals(false, folderToTest.getMaximized());
154
		folderToTest.getShell().close();
155
	}
156
	
157
	public void testMinimized() throws Exception {
158
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { minimized: true}");
159
		assertEquals(true, folderToTest.getMinimized());
160
		folderToTest.getShell().close();
161
		folderToTest = createTestCTabFolder("CTabFolder { minimized: false}");
162
		assertEquals(false, folderToTest.getMinimized());
163
		folderToTest.getShell().close();
164
	}
165
	
166
	public void testSingle() throws Exception {
167
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { single: true}");
168
		assertEquals(true, folderToTest.getSingle());
169
		folderToTest.getShell().close();
170
		folderToTest = createTestCTabFolder("CTabFolder { single: false}");
171
		assertEquals(false, folderToTest.getSingle());
172
		folderToTest.getShell().close();
173
	}
174
	
175
	public void testUnselectedCloseVisible() throws Exception {
176
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { unselectedCloseVisible: true}");
177
		assertEquals(true, folderToTest.getUnselectedCloseVisible());
178
		folderToTest.getShell().close();
179
		folderToTest = createTestCTabFolder("CTabFolder { unselectedCloseVisible: false}");
180
		assertEquals(false, folderToTest.getUnselectedCloseVisible());
181
		folderToTest.getShell().close();
182
	}
183
	
184
	public void testUnselectedImageVisible() throws Exception {
185
		CTabFolder folderToTest = createTestCTabFolder("CTabFolder { unselectedImageVisible: true}");
186
		assertEquals(true, folderToTest.getUnselectedImageVisible());
187
		folderToTest.getShell().close();
188
		folderToTest = createTestCTabFolder("CTabFolder { unselectedImageVisible: false}");
189
		assertEquals(false, folderToTest.getUnselectedImageVisible());
190
		folderToTest.getShell().close();
191
	}
70
}
192
}
(-)src/org/eclipse/e4/ui/tests/css/swt/CssSwtTestSuite.java (+3 lines)
Lines 18-22 Link Here
18
		addTestSuite(LabelTest.class);
18
		addTestSuite(LabelTest.class);
19
		addTestSuite(CTabFolderTest.class);
19
		addTestSuite(CTabFolderTest.class);
20
		addTestSuite(IdClassLabelColorTest.class);
20
		addTestSuite(IdClassLabelColorTest.class);
21
		addTestSuite(ShellTest.class);
22
		addTestSuite(ButtonTest.class);
23
		addTestSuite(CssSelectorPrecedence.class);
21
	}
24
	}
22
}
25
}
(-)src/org/eclipse/e4/ui/tests/css/swt/CSSTestCase.java (-1 / +6 lines)
Lines 1-6 Link Here
1
package org.eclipse.e4.ui.tests.css.swt;
1
package org.eclipse.e4.ui.tests.css.swt;
2
2
3
import java.io.IOException;
3
import java.io.IOException;
4
import java.io.Reader;
4
import java.io.StringReader;
5
import java.io.StringReader;
5
6
6
import junit.framework.TestCase;
7
import junit.framework.TestCase;
Lines 13-18 Link Here
13
public class CSSTestCase extends TestCase {
14
public class CSSTestCase extends TestCase {
14
	
15
	
15
	public CSSEngine createEngine(String styleSheet, Display display) {
16
	public CSSEngine createEngine(String styleSheet, Display display) {
17
		return createEngine(new StringReader(styleSheet), display);
18
	}
19
20
	public CSSEngine createEngine(Reader reader, Display display) {
16
		CSSEngine engine = new CSSSWTEngineImpl(display);
21
		CSSEngine engine = new CSSSWTEngineImpl(display);
17
		
22
		
18
		engine.setErrorHandler(new CSSErrorHandler() {
23
		engine.setErrorHandler(new CSSErrorHandler() {
Lines 22-28 Link Here
22
		});
27
		});
23
		
28
		
24
		try {
29
		try {
25
			engine.parseStyleSheet(new StringReader(styleSheet));
30
			engine.parseStyleSheet(reader);
26
		} catch (IOException e) {
31
		} catch (IOException e) {
27
			fail(e.getMessage());
32
			fail(e.getMessage());
28
		}
33
		}
(-)src/org/eclipse/e4/ui/tests/css/swt/CTabFolderAddedProperties.java (+112 lines)
Added Link Here
1
package org.eclipse.e4.ui.tests.css.swt;
2
3
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
4
import org.eclipse.swt.SWT;
5
import org.eclipse.swt.custom.CTabFolder;
6
import org.eclipse.swt.custom.CTabItem;
7
import org.eclipse.swt.layout.FillLayout;
8
import org.eclipse.swt.widgets.Display;
9
import org.eclipse.swt.widgets.Shell;
10
11
12
public class CTabFolderAddedProperties extends CSSTestCase {
13
	
14
	protected CTabFolder createFolder(String styleSheet) {
15
		Display display = Display.getDefault();
16
		CSSEngine engine = createEngine(styleSheet, display);
17
		
18
		// Create widgets
19
        Shell shell = new Shell(display, SWT.SHELL_TRIM);
20
 		FillLayout layout = new FillLayout();
21
 		shell.setLayout(layout);
22
 		
23
 		CTabFolder folderToTest = new CTabFolder(shell, SWT.NONE);
24
 		CTabItem tab1 = new CTabItem(folderToTest, SWT.NONE);
25
26
         // Apply Styles
27
 		engine.applyStyles(shell, true);
28
		
29
 		shell.pack();
30
        shell.open();
31
		return folderToTest;
32
	}
33
	        
34
//	        	Display display = Display.getDefault();
35
//	             CSSEngine engine = new CSSSWTEngineImpl(display);
36
//	             engine.parseStyleSheet(new StringReader("CTabFolder {showClose: true;}"));
37
//
38
//	             Shell shell = new Shell(display, SWT.SHELL_TRIM);
39
//	     		FillLayout layout = new FillLayout();
40
//	     		shell.setLayout(layout);
41
//	     		
42
//	     		CTabFolder folderToTest = new CTabFolder(shell, SWT.NONE);
43
//	     		CTabItem tab1 = new CTabItem(folderToTest, SWT.NONE);
44
//	     		tab1.setText("A TAB ITEM");
45
//
46
//	             // Apply Styles
47
//	     		engine.applyStyles(shell, true);
48
//	    		
49
//	     		shell.pack();
50
//	            shell.open();
51
	            
52
	public void testBorderVisible() throws Exception {
53
		CTabFolder folderToTest = createFolder("CTabFolder { borderVisible: true}");
54
		assertEquals(true, folderToTest.getBorderVisible());
55
		folderToTest.getShell().close();
56
	}
57
	
58
	public void testSimple() throws Exception {
59
		CTabFolder folderToTest = createFolder("CTabFolder { simple: true}");
60
		assertEquals(true, folderToTest.getSimple());
61
		folderToTest.getShell().close();
62
	}
63
	
64
	public void testMaximizeVisible() throws Exception {
65
		CTabFolder folderToTest = createFolder("CTabFolder { maximizeVisible: true}");
66
		assertEquals(true, folderToTest.getMaximizeVisible());
67
		folderToTest.getShell().close();
68
	}
69
	
70
	public void testMinimizeVisible() throws Exception {
71
		CTabFolder folderToTest = createFolder("CTabFolder { minimizeVisible: true}");
72
		assertEquals(true, folderToTest.getMinimizeVisible());
73
		folderToTest.getShell().close();
74
	}
75
	
76
	public void testMRUVisible() throws Exception {
77
		CTabFolder folderToTest = createFolder("CTabFolder { mruVisible: true}");
78
		assertEquals(true, folderToTest.getMRUVisible());
79
		folderToTest.getShell().close();
80
	}
81
	
82
	public void testMaximized() throws Exception {
83
		CTabFolder folderToTest = createFolder("CTabFolder { maximized: true}");
84
		assertEquals(true, folderToTest.getMaximized());
85
		folderToTest.getShell().close();
86
	}
87
	
88
	public void testMinimized() throws Exception {
89
		CTabFolder folderToTest = createFolder("CTabFolder { minimized: true}");
90
		assertEquals(true, folderToTest.getMinimized());
91
		folderToTest.getShell().close();
92
	}
93
	
94
	public void testSingle() throws Exception {
95
		CTabFolder folderToTest = createFolder("CTabFolder { single: true}");
96
		assertEquals(true, folderToTest.getSingle());
97
		folderToTest.getShell().close();
98
	}
99
	
100
	public void testUnselectedCloseVisible() throws Exception {
101
		CTabFolder folderToTest = createFolder("CTabFolder { unselectedCloseVisible: true}");
102
		assertEquals(true, folderToTest.getUnselectedCloseVisible());
103
		folderToTest.getShell().close();
104
	}
105
	
106
	public void testUnselectedImageVisible() throws Exception {
107
		CTabFolder folderToTest = createFolder("CTabFolder { unselectedImageVisible: true}");
108
		assertEquals(true, folderToTest.getUnselectedImageVisible());
109
		folderToTest.getShell().close();
110
	}
111
	    
112
}
(-)src/org/eclipse/e4/ui/tests/css/swt/CssSelectorPrecedence.java (+79 lines)
Added Link Here
1
package org.eclipse.e4.ui.tests.css.swt;
2
3
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
4
import org.eclipse.e4.ui.css.swt.CSSSWTConstants;
5
import org.eclipse.swt.SWT;
6
import org.eclipse.swt.graphics.RGB;
7
import org.eclipse.swt.layout.FillLayout;
8
import org.eclipse.swt.widgets.Composite;
9
import org.eclipse.swt.widgets.Display;
10
import org.eclipse.swt.widgets.Label;
11
import org.eclipse.swt.widgets.Shell;
12
13
14
public class CssSelectorPrecedence extends CSSTestCase{
15
	
16
	static final RGB RED = new RGB(255, 0, 0);
17
	static final RGB BLUE = new RGB(0, 0, 255);
18
	public Label labelToTest;
19
	
20
	protected Label labelToTest(String styleSheet) {
21
		Display display = Display.getDefault();
22
		CSSEngine engine = createEngine(styleSheet, display);
23
		
24
		// Create widgets
25
		Shell shell = new Shell(display, SWT.SHELL_TRIM);
26
		FillLayout layout = new FillLayout();
27
		shell.setLayout(layout);
28
29
		Composite panel = new Composite(shell, SWT.NONE);
30
		panel.setLayout(new FillLayout());
31
32
		Label label = new Label(panel, SWT.NONE);
33
		label.setText("Some label text");
34
		label.setData(CSSSWTConstants.CSS_ID_KEY, "labelTest");
35
		label.setData(CSSSWTConstants.CSS_CLASS_NAME_KEY, "labelTest");
36
		
37
			
38
			// Apply styles
39
		engine.applyStyles(shell,true);
40
41
		shell.pack();
42
		shell.open();
43
		engine.applyStyles(labelToTest, true);
44
		return label;
45
	}
46
	
47
48
	public void testRedundancy(){
49
		labelToTest = labelToTest("Label { background-color: #FF0000;} " +
50
								"Label {background-color: #0000FF;} ");
51
		assertEquals(BLUE, labelToTest.getBackground().getRGB());
52
	}
53
	
54
		public void testBug261018(){
55
		labelToTest = labelToTest("Label {background-color: #FF0000;}" +
56
								"Shell, Label {background-color: #0000FF;}");
57
		assertEquals(BLUE, labelToTest.getBackground().getRGB());
58
	}
59
	
60
	public void testWithClassNameAndID() {
61
		labelToTest = labelToTest("Label { background-color: #FF0000; color: #0000FF} " +
62
								"#labelTest {background-color: #0000FF;} ");
63
		assertEquals(BLUE, labelToTest.getBackground().getRGB());
64
	}
65
	
66
	public void testWithClassNameAndPseudoClass() {
67
		labelToTest = labelToTest("Label { background-color: #FF0000; color: #0000FF} " +
68
								".labelTest {background-color: #0000FF;} ");
69
		assertEquals(BLUE, labelToTest.getBackground().getRGB());
70
	}
71
	
72
	public void testImportant(){
73
		labelToTest = labelToTest("Label {background-color: rgb(255,0,0);}" +
74
								"Label { background-color: rgb(0,0,255) ! important;}" +
75
								"Label {background-color: rgb(255,0,0);}");
76
		assertEquals(BLUE, labelToTest.getBackground().getRGB());
77
	}
78
	
79
}
(-)src/org/eclipse/e4/ui/tests/css/swt/WidgetBehaviour.java (+65 lines)
Added Link Here
1
package org.eclipse.e4.ui.tests.css.swt;
2
3
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
4
import org.eclipse.e4.ui.css.swt.CSSSWTConstants;
5
import org.eclipse.swt.SWT;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.graphics.RGB;
8
import org.eclipse.swt.layout.FillLayout;
9
import org.eclipse.swt.widgets.Button;
10
import org.eclipse.swt.widgets.Composite;
11
import org.eclipse.swt.widgets.Display;
12
import org.eclipse.swt.widgets.Label;
13
import org.eclipse.swt.widgets.Shell;
14
import org.eclipse.swt.widgets.Text;
15
16
17
public class WidgetBehaviour extends CSSTestCase {
18
19
	public static Button button;
20
	public static Text text;
21
	public static Label label;
22
	public static CTabFolder tabFolder;
23
	public static Shell shell;
24
	public static Composite panel;
25
	public static FillLayout layout;
26
	static final RGB RED = new RGB(255, 0, 0);
27
28
	public void createTest(String styleSheet) {
29
		Display display = Display.getDefault();
30
		CSSEngine engine = createEngine(styleSheet, display);
31
		
32
		// Create widgets
33
		shell = new Shell(display, SWT.SHELL_TRIM);
34
		layout = new FillLayout();
35
		shell.setLayout(layout);
36
37
		panel = new Composite(shell, SWT.NONE);
38
		panel.setLayout(new FillLayout());
39
40
		label = new Label(panel, SWT.NONE);
41
		label.setText("Some label text");
42
		
43
		button = new Button(panel, SWT.NONE);
44
		button.setText("Some button text");
45
		
46
		text = new Text(panel, SWT.NONE);
47
		text.setText("Some text");
48
		
49
		tabFolder = new CTabFolder(panel, SWT.NONE);
50
			// Apply styles
51
		engine.applyStyles(shell,true);
52
53
		shell.pack();
54
		shell.open();
55
		engine.applyStyles(shell, true);
56
	}
57
	
58
	public void testBackgroudColor(){
59
		createTest("Label, Button, Shell  { background-color: #FF0000;}");
60
		assertEquals(RED, button.getBackground().getRGB());
61
		assertEquals(RED, label.getBackground().getRGB());
62
63
	}
64
65
}
(-)src/org/eclipse/e4/ui/tests/css/swt/ShellTest.java (+74 lines)
Added Link Here
1
package org.eclipse.e4.ui.tests.css.swt;
2
3
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
4
import org.eclipse.swt.SWT;
5
import org.eclipse.swt.graphics.FontData;
6
import org.eclipse.swt.graphics.RGB;
7
import org.eclipse.swt.layout.FillLayout;
8
import org.eclipse.swt.widgets.Composite;
9
import org.eclipse.swt.widgets.Display;
10
import org.eclipse.swt.widgets.Shell;
11
12
public class ShellTest extends CSSTestCase {
13
14
	static final RGB RED = new RGB(255, 0, 0);
15
	static final RGB GREEN = new RGB(0, 255, 0);
16
	static final RGB BLUE = new RGB(0, 0, 255);
17
		
18
	protected Shell createTestShell(String styleSheet) {
19
		Display display = Display.getDefault();
20
		CSSEngine engine = createEngine(styleSheet, display);
21
		
22
		// Create widgets
23
		Shell shell = new Shell(display, SWT.SHELL_TRIM);
24
		FillLayout layout = new FillLayout();
25
		shell.setLayout(layout);
26
27
		Composite panel = new Composite(shell, SWT.NONE);
28
		panel.setLayout(new FillLayout());
29
30
		// Apply styles
31
		engine.applyStyles(shell, true);
32
33
		shell.pack();
34
		shell.open();
35
		return shell;
36
	}
37
	
38
	
39
	public void testColor() throws Exception {
40
		Shell shellToTest = createTestShell("Shell { background-color: #FF0000; color: #0000FF }");
41
		assertEquals(RED, shellToTest.getBackground().getRGB());
42
		assertEquals(BLUE, shellToTest.getForeground().getRGB());
43
		shellToTest.getShell().close();
44
	}
45
46
	public void testFontRegular() throws Exception {
47
		Shell shellToTest = createTestShell("Shell { font: Verdana 16px }");
48
		assertEquals(1, shellToTest.getFont().getFontData().length);
49
		FontData fontData = shellToTest.getFont().getFontData()[0];
50
		assertEquals("Verdana", fontData.getName());
51
		assertEquals(16, fontData.getHeight());
52
		assertEquals(SWT.NORMAL, fontData.getStyle());		
53
		shellToTest.getShell().close();
54
	}
55
56
	public void testFontBold() throws Exception {
57
		Shell shellToTest = createTestShell("Shell { font: Arial 12px; font-weight: bold }");
58
		assertEquals(1, shellToTest.getFont().getFontData().length);
59
		FontData fontData = shellToTest.getFont().getFontData()[0];
60
		assertEquals("Arial", fontData.getName());
61
		assertEquals(12, fontData.getHeight());
62
		assertEquals(SWT.BOLD, fontData.getStyle());		
63
		shellToTest.getShell().close();
64
	}
65
66
	public void testFontItalic() throws Exception {
67
		Shell shellToTest = createTestShell("Shell { font-style: italic }");
68
		assertEquals(1, shellToTest.getFont().getFontData().length);
69
		FontData fontData = shellToTest.getFont().getFontData()[0];
70
		assertEquals(SWT.ITALIC, fontData.getStyle());		
71
		shellToTest.getShell().close();
72
	}
73
74
}
(-)src/org/eclipse/e4/ui/tests/css/swt/ButtonTest.java (+84 lines)
Added Link Here
1
package org.eclipse.e4.ui.tests.css.swt;
2
3
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
4
import org.eclipse.swt.SWT;
5
import org.eclipse.swt.graphics.FontData;
6
import org.eclipse.swt.graphics.RGB;
7
import org.eclipse.swt.layout.FillLayout;
8
import org.eclipse.swt.widgets.Composite;
9
import org.eclipse.swt.widgets.Display;
10
import org.eclipse.swt.widgets.Button;
11
import org.eclipse.swt.widgets.Shell;
12
13
public class ButtonTest extends CSSTestCase {
14
15
	static final RGB RED = new RGB(255, 0, 0);
16
	static final RGB GREEN = new RGB(0, 255, 0);
17
	static final RGB BLUE = new RGB(0, 0, 255);
18
		
19
	protected Button createTestButton(String styleSheet) {
20
		Display display = Display.getDefault();
21
		CSSEngine engine = createEngine(styleSheet, display);
22
		
23
		// Create widgets
24
		Shell shell = new Shell(display, SWT.SHELL_TRIM);
25
		FillLayout layout = new FillLayout();
26
		shell.setLayout(layout);
27
28
		Composite panel = new Composite(shell, SWT.NONE);
29
		panel.setLayout(new FillLayout());
30
31
		Button buttonToTest = new Button(panel, SWT.NONE);
32
		buttonToTest.setText("Some button text");
33
34
		// Apply styles
35
		engine.applyStyles(shell, true);
36
37
		shell.pack();
38
		shell.open();
39
		return buttonToTest;
40
	}
41
	
42
	
43
	public void testColor() throws Exception {
44
		Button buttonToTest = createTestButton("Button { background-color: #FF0000; color: #0000FF }");
45
		assertEquals(RED, buttonToTest.getBackground().getRGB());
46
		assertEquals(BLUE, buttonToTest.getForeground().getRGB());
47
		buttonToTest.getShell().close();
48
	}
49
50
	public void testFontRegular() throws Exception {
51
		Button buttonToTest = createTestButton("Button { font: Verdana 16px }");
52
		assertEquals(1, buttonToTest.getFont().getFontData().length);
53
		FontData fontData = buttonToTest.getFont().getFontData()[0];
54
		assertEquals("Verdana", fontData.getName());
55
		assertEquals(16, fontData.getHeight());
56
		assertEquals(SWT.NORMAL, fontData.getStyle());		
57
		buttonToTest.getShell().close();
58
	}
59
60
	public void testFontBold() throws Exception {
61
		Button buttonToTest = createTestButton("Button { font: Arial 12px; font-weight: bold }");
62
		assertEquals(1, buttonToTest.getFont().getFontData().length);
63
		FontData fontData = buttonToTest.getFont().getFontData()[0];
64
		assertEquals("Arial", fontData.getName());
65
		assertEquals(12, fontData.getHeight());
66
		assertEquals(SWT.BOLD, fontData.getStyle());		
67
		buttonToTest.getShell().close();
68
	}
69
70
	public void testFontItalic() throws Exception {
71
		Button buttonToTest = createTestButton("Button { font-style: italic }");
72
		assertEquals(1, buttonToTest.getFont().getFontData().length);
73
		FontData fontData = buttonToTest.getFont().getFontData()[0];
74
		assertEquals(SWT.ITALIC, fontData.getStyle());		
75
		buttonToTest.getShell().close();
76
	}
77
	
78
	public void testBorder() throws Exception {
79
		Button buttonToTest = createTestButton("Button { border-width: 2;}");
80
		assertEquals(buttonToTest.getBorderWidth(), 2);		
81
		buttonToTest.getShell().close();
82
	}
83
84
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/AbstractCSSPropertyBorderHandler.java (-49 / +50 lines)
Lines 30-83 Link Here
30
30
31
	public boolean applyCSSProperty(Object element, String property,
31
	public boolean applyCSSProperty(Object element, String property,
32
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
32
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
33
		// Border
33
34
		if ("border".equals(property))
34
			// Border
35
			applyCSSPropertyBorder(element, value, pseudo, engine);
35
			if ("border".equals(property))
36
		// Border bottom
36
				applyCSSPropertyBorder(element, value, pseudo, engine);
37
		else if ("border-bottom".equals(property))
37
			// Border bottom
38
			applyCSSPropertyBorderBottom(element, value, pseudo, engine);
38
			else if ("border-bottom".equals(property))
39
		else if ("border-bottom-color".equals(property))
39
				applyCSSPropertyBorderBottom(element, value, pseudo, engine);
40
			applyCSSPropertyBorderBottomColor(element, value, pseudo, engine);
40
			else if ("border-bottom-color".equals(property))
41
		else if ("border-bottom-style".equals(property))
41
				applyCSSPropertyBorderBottomColor(element, value, pseudo, engine);
42
			applyCSSPropertyBorderBottomStyle(element, value, pseudo, engine);
42
			else if ("border-bottom-style".equals(property))
43
		else if ("border-bottom-width".equals(property))
43
				applyCSSPropertyBorderBottomStyle(element, value, pseudo, engine);
44
			applyCSSPropertyBorderBottomWidth(element, value, pseudo, engine);
44
			else if ("border-bottom-width".equals(property))
45
		// Border color
45
				applyCSSPropertyBorderBottomWidth(element, value, pseudo, engine);
46
		else if ("border-color".equals(property))
46
			// Border color
47
			applyCSSPropertyBorderColor(element, value, pseudo, engine);
47
			else if ("border-color".equals(property))
48
		// Border left
48
				applyCSSPropertyBorderColor(element, value, pseudo, engine);
49
		else if ("border-left".equals(property))
49
			// Border left
50
			applyCSSPropertyBorderLeft(element, value, pseudo, engine);
50
			else if ("border-left".equals(property))
51
		else if ("border-left-color".equals(property))
51
				applyCSSPropertyBorderLeft(element, value, pseudo, engine);
52
			applyCSSPropertyBorderLeftColor(element, value, pseudo, engine);
52
			else if ("border-left-color".equals(property))
53
		else if ("border-left-style".equals(property))
53
				applyCSSPropertyBorderLeftColor(element, value, pseudo, engine);
54
			applyCSSPropertyBorderLeftStyle(element, value, pseudo, engine);
54
			else if ("border-left-style".equals(property))
55
		else if ("border-left-width".equals(property))
55
				applyCSSPropertyBorderLeftStyle(element, value, pseudo, engine);
56
			applyCSSPropertyBorderLeftWidth(element, value, pseudo, engine);
56
			else if ("border-left-width".equals(property))
57
		// Border right
57
				applyCSSPropertyBorderLeftWidth(element, value, pseudo, engine);
58
		else if ("border-right".equals(property))
58
			// Border right
59
			applyCSSPropertyBorderRight(element, value, pseudo, engine);
59
			else if ("border-right".equals(property))
60
		else if ("border-right-color".equals(property))
60
				applyCSSPropertyBorderRight(element, value, pseudo, engine);
61
			applyCSSPropertyBorderRightColor(element, value, pseudo, engine);
61
			else if ("border-right-color".equals(property))
62
		else if ("border-right-style".equals(property))
62
				applyCSSPropertyBorderRightColor(element, value, pseudo, engine);
63
			applyCSSPropertyBorderRightStyle(element, value, pseudo, engine);
63
			else if ("border-right-style".equals(property))
64
		else if ("border-right-width".equals(property))
64
				applyCSSPropertyBorderRightStyle(element, value, pseudo, engine);
65
			applyCSSPropertyBorderRightWidth(element, value, pseudo, engine);
65
			else if ("border-right-width".equals(property))
66
		// Border style
66
				applyCSSPropertyBorderRightWidth(element, value, pseudo, engine);
67
		else if ("border-style".equals(property))
67
			// Border style
68
			applyCSSPropertyBorderStyle(element, value, pseudo, engine);
68
			else if ("border-style".equals(property))
69
		// Border top
69
				applyCSSPropertyBorderStyle(element, value, pseudo, engine);
70
		else if ("border-top".equals(property))
70
			// Border top
71
			applyCSSPropertyBorderTop(element, value, pseudo, engine);
71
			else if ("border-top".equals(property))
72
		else if ("border-top-color".equals(property))
72
				applyCSSPropertyBorderTop(element, value, pseudo, engine);
73
			applyCSSPropertyBorderTopColor(element, value, pseudo, engine);
73
			else if ("border-top-color".equals(property))
74
		else if ("border-top-style".equals(property))
74
				applyCSSPropertyBorderTopColor(element, value, pseudo, engine);
75
			applyCSSPropertyBorderTopStyle(element, value, pseudo, engine);
75
			else if ("border-top-style".equals(property))
76
		else if ("border-top-width".equals(property))
76
				applyCSSPropertyBorderTopStyle(element, value, pseudo, engine);
77
			applyCSSPropertyBorderTopWidth(element, value, pseudo, engine);
77
			else if ("border-top-width".equals(property))
78
		// Border width
78
				applyCSSPropertyBorderTopWidth(element, value, pseudo, engine);
79
		else if ("border-width".equals(property))
79
			// Border width
80
			applyCSSPropertyBorderWidth(element, value, pseudo, engine);
80
			else if ("border-width".equals(property))
81
				applyCSSPropertyBorderWidth(element, value, pseudo, engine);
81
		return false;
82
		return false;
82
	}
83
	}
83
84
Lines 139-145 Link Here
139
		super.applyCSSPropertyComposite(element, "border", value, pseudo,
140
		super.applyCSSPropertyComposite(element, "border", value, pseudo,
140
				engine);
141
				engine);
141
	}
142
	}
142
143
	
143
	public void applyCSSPropertyBorderBottom(Object element, CSSValue value,
144
	public void applyCSSPropertyBorderBottom(Object element, CSSValue value,
144
			String pseudo, CSSEngine engine) throws Exception {
145
			String pseudo, CSSEngine engine) throws Exception {
145
		throw new UnsupportedPropertyException("border-bottom");
146
		throw new UnsupportedPropertyException("border-bottom");
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/AbstractCSSPropertyBorderCompositeHandler.java (-2 / +2 lines)
Lines 29-35 Link Here
29
		AbstractCSSPropertyCompositeHandler {
29
		AbstractCSSPropertyCompositeHandler {
30
30
31
	private static final String[] BORDER_CSSPROPERTIES = { "border-width",
31
	private static final String[] BORDER_CSSPROPERTIES = { "border-width",
32
			"border-style", "border-color" };
32
			"border-style", "border-color"};
33
33
34
	public void applyCSSProperty(Object element, CSSValue value, String pseudo,
34
	public void applyCSSProperty(Object element, CSSValue value, String pseudo,
35
			CSSEngine engine) throws Exception {
35
			CSSEngine engine) throws Exception {
Lines 50-57 Link Here
50
			case CSSPrimitiveValue.CSS_RGBCOLOR:
50
			case CSSPrimitiveValue.CSS_RGBCOLOR:
51
				engine.applyCSSProperty(element, "border-color", value, pseudo);
51
				engine.applyCSSProperty(element, "border-color", value, pseudo);
52
				break;
52
				break;
53
			case CSSPrimitiveValue.CSS_PT:
54
			case CSSPrimitiveValue.CSS_NUMBER:
53
			case CSSPrimitiveValue.CSS_NUMBER:
54
			case CSSPrimitiveValue.CSS_PT:
55
			case CSSPrimitiveValue.CSS_PX:
55
			case CSSPrimitiveValue.CSS_PX:
56
				engine.applyCSSProperty(element, "border-width", value, pseudo);
56
				engine.applyCSSProperty(element, "border-width", value, pseudo);
57
				break;
57
				break;
(-)META-INF/MANIFEST.MF (+1 lines)
Lines 14-19 Link Here
14
 org.eclipse.e4.ui.css.core.dom.selectors,
14
 org.eclipse.e4.ui.css.core.dom.selectors,
15
 org.eclipse.e4.ui.css.core.engine,
15
 org.eclipse.e4.ui.css.core.engine,
16
 org.eclipse.e4.ui.css.core.exceptions,
16
 org.eclipse.e4.ui.css.core.exceptions,
17
 org.eclipse.e4.ui.css.core.impl.dom,
17
 org.eclipse.e4.ui.css.core.impl.dom.parsers,
18
 org.eclipse.e4.ui.css.core.impl.dom.parsers,
18
 org.eclipse.e4.ui.css.core.impl.dom.properties,
19
 org.eclipse.e4.ui.css.core.impl.dom.properties,
19
 org.eclipse.e4.ui.css.core.impl.engine,
20
 org.eclipse.e4.ui.css.core.impl.engine,
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyMaximizeVisibleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyMaximizeVisibleHandler extends ICSSPropertyHandler {
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyMruVisibleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyMruVisibleHandler extends ICSSPropertyHandler {
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyShowCloseHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyShowCloseHandler extends ICSSPropertyHandler {
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyMaximizedHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyMaximizedHandler extends ICSSPropertyHandler{
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyMinimizeVisibleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyMinimizeVisibleHandler extends ICSSPropertyHandler {
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyBorderVisibleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyBorderVisibleHandler extends ICSSPropertyHandler{
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyUnselectedCloseVisibleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyUnselectedCloseVisibleHandler extends ICSSPropertyHandler{
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertySingleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertySingleHandler extends ICSSPropertyHandler{
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertySimpleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertySimpleHandler extends ICSSPropertyHandler {
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyMinimizedHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyMinimizedHandler extends ICSSPropertyHandler{
6
7
}
(-)src/org/eclipse/e4/ui/css/core/dom/properties/css2/ICSSPropertyUnselectedImageVisibleHandler.java (+7 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.dom.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
5
public interface ICSSPropertyUnselectedImageVisibleHandler extends ICSSPropertyHandler{
6
7
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBorderSWTHandler.java (-2 / +7 lines)
Lines 36-41 Link Here
36
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
36
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
37
		Control control = SWTElementHelpers.getControl(element);
37
		Control control = SWTElementHelpers.getControl(element);
38
		if (control != null) {
38
		if (control != null) {
39
39
			Composite parent = control.getParent();
40
			Composite parent = control.getParent();
40
			if (parent == null)
41
			if (parent == null)
41
				return true;
42
				return true;
Lines 52-62 Link Here
52
			if((parent.getData("CSS_SUPPORTS_BORDERS") != null) && 
53
			if((parent.getData("CSS_SUPPORTS_BORDERS") != null) && 
53
					(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
54
					(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
54
				int pixelValue = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT);
55
				int pixelValue = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT);
56
				
55
				if(property.equals("border-width")) {
57
				if(property.equals("border-width")) {
56
					((FillLayout) parent.getLayout()).marginWidth = pixelValue;
58
					
57
					((FillLayout) parent.getLayout()).marginHeight = pixelValue;
59
//					((FillLayout) parent.getLayout()).marginWidth = pixelValue;
60
//					((FillLayout) parent.getLayout()).marginHeight = pixelValue;								
58
				}
61
				}
62
											
59
			}
63
			}
64
60
			return true;
65
			return true;
61
		} else {
66
		} else {
62
			if (element instanceof CSSBorderProperties) {
67
			if (element instanceof CSSBorderProperties) {
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/lazy/background/CSSPropertyBackgroundColorHandler.java (-1 / +2 lines)
Lines 29-35 Link Here
29
					.getDisplay());
29
					.getDisplay());
30
			if (control instanceof CTabFolder && "selected".equals(pseudo)) {
30
			if (control instanceof CTabFolder && "selected".equals(pseudo)) {
31
				((CTabFolder) control).setSelectionBackground(newColor);
31
				((CTabFolder) control).setSelectionBackground(newColor);
32
			} else {
32
			} 
33
			else {
33
				control.setBackground(newColor);
34
				control.setBackground(newColor);
34
			}
35
			}
35
		} else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
36
		} else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
(-)src/org/eclipse/e4/ui/css/swt/dom/SWTElement.java (+1 lines)
Lines 131-136 Link Here
131
			// which set background Color when a CTabItem is selected.
131
			// which set background Color when a CTabItem is selected.
132
			super.addStaticPseudoInstance("selected");
132
			super.addStaticPseudoInstance("selected");
133
		}
133
		}
134
134
	}
135
	}
135
136
136
	/**
137
	/**
(-)src/org/eclipse/e4/ui/css/swt/engine/CSSSWTEngineImpl.java (+71 lines)
Lines 12-25 Link Here
12
12
13
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyBackgroundHandler;
13
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyBackgroundHandler;
14
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyBorderHandler;
14
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyBorderHandler;
15
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyBorderVisibleHandler;
15
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyClassificationHandler;
16
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyClassificationHandler;
16
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyFontHandler;
17
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyFontHandler;
18
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyMaximizeVisibleHandler;
19
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyMaximizedHandler;
20
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyMinimizeVisibleHandler;
21
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyMinimizedHandler;
22
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyMruVisibleHandler;
23
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyShowCloseHandler;
24
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertySimpleHandler;
25
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertySingleHandler;
17
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyTextHandler;
26
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyTextHandler;
27
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyUnselectedCloseVisibleHandler;
28
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyUnselectedImageVisibleHandler;
18
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBackgroundSWTHandler;
29
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBackgroundSWTHandler;
19
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBorderSWTHandler;
30
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBorderSWTHandler;
31
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBorderVisibleSWTHandler;
20
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyClassificationSWTHandler;
32
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyClassificationSWTHandler;
21
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyFontSWTHandler;
33
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyFontSWTHandler;
34
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyMaximizeVisibleSWTHandler;
35
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyMaximizedSWTHandler;
36
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyMinimizeVisibleSWTHandler;
37
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyMinimizedSWTHandler;
38
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyMruVisibleSWTHandler;
39
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyShowCloseSWTHandler;
40
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertySimpleSWTHandler;
41
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertySingleSWTHandler;
22
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyTextSWTHandler;
42
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyTextSWTHandler;
43
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyUnselectedCloseVisibleSWTHandler;
44
import org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyUnselectedImageVisibleSWTHandler;
23
import org.eclipse.e4.ui.css.xml.properties.css2.CSSPropertyBackgroundXMLHandler;
45
import org.eclipse.e4.ui.css.xml.properties.css2.CSSPropertyBackgroundXMLHandler;
24
import org.eclipse.e4.ui.css.xml.properties.css2.CSSPropertyFontXMLHandler;
46
import org.eclipse.e4.ui.css.xml.properties.css2.CSSPropertyFontXMLHandler;
25
import org.eclipse.e4.ui.css.xml.properties.css2.CSSPropertyTextXMLHandler;
47
import org.eclipse.e4.ui.css.xml.properties.css2.CSSPropertyTextXMLHandler;
Lines 43-48 Link Here
43
		// Register SWT CSS Property Background Handler
65
		// Register SWT CSS Property Background Handler
44
		super.registerCSSPropertyHandler(ICSSPropertyBackgroundHandler.class,
66
		super.registerCSSPropertyHandler(ICSSPropertyBackgroundHandler.class,
45
				CSSPropertyBackgroundSWTHandler.INSTANCE);
67
				CSSPropertyBackgroundSWTHandler.INSTANCE);
68
		//test
69
		//Register Border property
70
		super.registerCSSProperty("borderVisible", ICSSPropertyBorderHandler.class);
71
		//done test
72
		
46
		// Register SWT CSS Property Border Handler
73
		// Register SWT CSS Property Border Handler
47
		super.registerCSSPropertyHandler(ICSSPropertyBorderHandler.class,
74
		super.registerCSSPropertyHandler(ICSSPropertyBorderHandler.class,
48
				CSSPropertyBorderSWTHandler.INSTANCE);
75
				CSSPropertyBorderSWTHandler.INSTANCE);
Lines 66-71 Link Here
66
		// Register XML CSS Property Font Handler
93
		// Register XML CSS Property Font Handler
67
		super.registerCSSPropertyHandler(ICSSPropertyFontHandler.class,
94
		super.registerCSSPropertyHandler(ICSSPropertyFontHandler.class,
68
				CSSPropertyFontXMLHandler.INSTANCE);
95
				CSSPropertyFontXMLHandler.INSTANCE);
96
		//Register SWT CSS Property BorderVisible
97
		super.registerCSSProperty("borderVisible", ICSSPropertyBorderVisibleHandler.class);  
98
		super.registerCSSPropertyHandler(ICSSPropertyBorderVisibleHandler.class,
99
				CSSPropertyBorderVisibleSWTHandler.INSTANCE);
100
		//Register SWT CSS Property Simple
101
		super.registerCSSProperty("simple", ICSSPropertySimpleHandler.class);  
102
		super.registerCSSPropertyHandler(ICSSPropertySimpleHandler.class,
103
				CSSPropertySimpleSWTHandler.INSTANCE);
104
		//Register SWT CSS Property MaximizeVisible
105
		super.registerCSSProperty("maximizeVisible", ICSSPropertyMaximizeVisibleHandler.class);  
106
		super.registerCSSPropertyHandler(ICSSPropertyMaximizeVisibleHandler.class,
107
				CSSPropertyMaximizeVisibleSWTHandler.INSTANCE);
108
		//Register SWT CSS Property MinimizeVisible
109
		super.registerCSSProperty("minimizeVisible", ICSSPropertyMinimizeVisibleHandler.class);  
110
		super.registerCSSPropertyHandler(ICSSPropertyMinimizeVisibleHandler.class,
111
				CSSPropertyMinimizeVisibleSWTHandler.INSTANCE);
112
		//Register SWT CSS Property ShowClose
113
		super.registerCSSProperty("showClose", ICSSPropertyShowCloseHandler.class);  
114
		super.registerCSSPropertyHandler(ICSSPropertyShowCloseHandler.class,
115
				CSSPropertyShowCloseSWTHandler.INSTANCE);
116
		//Register SWT CSS Property mruVisible
117
		super.registerCSSProperty("mruVisible", ICSSPropertyMruVisibleHandler.class);  
118
		super.registerCSSPropertyHandler(ICSSPropertyMruVisibleHandler.class,
119
				CSSPropertyMruVisibleSWTHandler.INSTANCE);
120
		//Register SWT CSS Property Maximized
121
		super.registerCSSProperty("maximized", ICSSPropertyMaximizedHandler.class);  
122
		super.registerCSSPropertyHandler(ICSSPropertyMaximizedHandler.class,
123
				CSSPropertyMaximizedSWTHandler.INSTANCE);
124
		//Register SWT CSS Property Minimized
125
		super.registerCSSProperty("minimized", ICSSPropertyMinimizedHandler.class);  
126
		super.registerCSSPropertyHandler(ICSSPropertyMinimizedHandler.class,
127
				CSSPropertyMinimizedSWTHandler.INSTANCE);
128
		//Register SWT CSS Property Single
129
		super.registerCSSProperty("single", ICSSPropertySingleHandler.class);  
130
		super.registerCSSPropertyHandler(ICSSPropertySingleHandler.class,
131
				CSSPropertySingleSWTHandler.INSTANCE);
132
		//Register SWT CSS Property UnselectedCloseVisible
133
		super.registerCSSProperty("unselectedCloseVisible", ICSSPropertyUnselectedCloseVisibleHandler.class);  
134
		super.registerCSSPropertyHandler(ICSSPropertyUnselectedCloseVisibleHandler.class,
135
				CSSPropertyUnselectedCloseVisibleSWTHandler.INSTANCE);
136
		//Register SWT CSS Property UnselectedImageVisible
137
		super.registerCSSProperty("unselectedImageVisible", ICSSPropertyUnselectedImageVisibleHandler.class);  
138
		super.registerCSSPropertyHandler(ICSSPropertyUnselectedImageVisibleHandler.class,
139
				CSSPropertyUnselectedImageVisibleSWTHandler.INSTANCE);
69
	}
140
	}
70
141
71
}
142
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyMruVisibleSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyMruVisibleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyMruVisibleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isMruVisible = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setMRUVisible(isMruVisible);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyUnselectedCloseVisibleSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyUnselectedCloseVisibleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyUnselectedCloseVisibleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isUnselectedClose = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setUnselectedCloseVisible(isUnselectedClose);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyUnselectedImageVisibleSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyUnselectedImageVisibleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyUnselectedImageVisibleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isUnselectedImage = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setUnselectedImageVisible(isUnselectedImage);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBorderVisibleSWTHandler.java (+27 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyBorderVisibleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyBorderVisibleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isBorderVisible = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setBorderVisible(isBorderVisible);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyMinimizeVisibleSWTHandler.java (+27 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyMinimizeVisibleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyMinimizeVisibleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isMinVisible = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setMinimizeVisible(isMinVisible);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyShowCloseSWTHandler.java (+31 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.custom.CTabItem;
8
import org.eclipse.swt.widgets.Control;
9
import org.w3c.dom.css.CSSValue;
10
11
public class CSSPropertyShowCloseSWTHandler extends AbstractCSSPropertySWTHandler{
12
13
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyShowCloseSWTHandler();
14
	
15
	public void applyCSSProperty(Control control, String property,
16
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
17
		boolean isShowClose = (Boolean)engine.convert(value, Boolean.class, null);
18
		if (control instanceof CTabFolder) {
19
			CTabFolder folder = (CTabFolder) control;
20
			CTabItem[] itemList = folder.getItems();
21
			for(CTabItem item: itemList){
22
				item.setShowClose(isShowClose);
23
			}
24
		}
25
	}
26
27
	public String retrieveCSSProperty(Control control, String property,
28
			String pseudo, CSSEngine engine) throws Exception {
29
		return null;
30
	}
31
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyMaximizedSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyMaximizedSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyMaximizedSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isMaximized = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setMaximized(isMaximized);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertySimpleSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertySimpleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertySimpleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isSimple = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setSimple(isSimple);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertySingleSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertySingleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertySingleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isSingle = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setSingle(isSingle);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyMaximizeVisibleSWTHandler.java (+27 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyMaximizeVisibleSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyMaximizeVisibleSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isMaxVisible = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setMaximizeVisible(isMaxVisible);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
}
(-)src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyMinimizedSWTHandler.java (+29 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.swt.properties.css2;
2
3
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
4
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
5
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
6
import org.eclipse.swt.custom.CTabFolder;
7
import org.eclipse.swt.widgets.Control;
8
import org.w3c.dom.css.CSSValue;
9
10
public class CSSPropertyMinimizedSWTHandler extends AbstractCSSPropertySWTHandler{
11
12
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertyMinimizedSWTHandler();
13
	
14
	public void applyCSSProperty(Control control, String property,
15
		    CSSValue value, String pseudo, CSSEngine engine) throws Exception {
16
		boolean isMinimized = (Boolean)engine.convert(value, Boolean.class, null);
17
		if (control instanceof CTabFolder) {
18
			CTabFolder folder = (CTabFolder) control;
19
			folder.setMinimized(isMinimized);
20
		}
21
	}
22
23
	public String retrieveCSSProperty(Control control, String property,
24
			String pseudo, CSSEngine engine) throws Exception {
25
		return null;
26
	}
27
28
29
}

Return to bug 263181