blob: 8f80eae09ab3c6972bc9b849fe23dc635a4205c0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*******************************************************************************
* Copyright (c) 2010, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.ui.css.swt.properties.custom;
import java.lang.reflect.Method;
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabFolderRenderer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Control;
import org.w3c.dom.css.CSSValue;
public class CSSPropertyOuterKeylineSWTHandler extends AbstractCSSPropertySWTHandler {
public static final ICSSPropertyHandler INSTANCE = new CSSPropertyOuterKeylineSWTHandler();
@Override
protected void applyCSSProperty(Control control, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
if (!(control instanceof CTabFolder)) return;
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
Color newColor = (Color) engine.convert(value, Color.class, control.getDisplay());
CTabFolderRenderer renderer = ((CTabFolder) control).getRenderer();
if (renderer == null) return;
try {
Method m = renderer.getClass().getMethod("setOuterKeyline", new Class[]{Color.class});
m.invoke(renderer, newColor);
} catch(NoSuchMethodException e) {/*IGNORED*/}
}
}
@Override
protected String retrieveCSSProperty(Control control, String property,
String pseudo, CSSEngine engine) throws Exception {
// TODO Auto-generated method stub
return null;
}
}
|