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 320784 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (+8 lines)
Lines 299-304 Link Here
299
               name="unselected-image-visible">
299
               name="unselected-image-visible">
300
         </property-name>
300
         </property-name>
301
      </handler>
301
      </handler>
302
      <handler
303
            adapter="org.eclipse.e4.ui.css.swt.dom.CTabFolderElement"
304
            composite="false"
305
            handler="org.eclipse.e4.ui.css.swt.properties.custom.CSSPropertySelectedTabsSWTHandler">
306
         <property-name
307
               name="selected-tabs-background">
308
         </property-name>
309
      </handler>
302
   </extension>
310
   </extension>
303
               
311
               
304
312
(-)src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedTabsSWTHandler.java (+53 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others. All rights reserved. This
3
 * program and the accompanying materials are made available under the terms of
4
 * the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Contributors: IBM Corporation - initial API and implementation
8
 *******************************************************************************/
9
package org.eclipse.e4.ui.css.swt.properties.custom;
10
11
import org.eclipse.e4.ui.widgets.CTabFolder;
12
import org.eclipse.e4.ui.widgets.CTabFolderRenderer;
13
14
import java.lang.reflect.Method;
15
16
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
17
import org.eclipse.e4.core.contexts.IEclipseContext;
18
import org.eclipse.e4.ui.css.core.dom.properties.Gradient;
19
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
20
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
21
import org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper;
22
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
23
import org.eclipse.swt.graphics.Color;
24
import org.eclipse.swt.widgets.Control;
25
import org.w3c.dom.css.CSSValue;
26
27
public class CSSPropertySelectedTabsSWTHandler extends AbstractCSSPropertySWTHandler {
28
29
	
30
	public static final ICSSPropertyHandler INSTANCE = new CSSPropertySelectedTabsSWTHandler();
31
	
32
	@Override
33
	protected void applyCSSProperty(Control control, String property,
34
			CSSValue value, String pseudo, CSSEngine engine) throws Exception {
35
		if (!(control instanceof CTabFolder)) return;
36
		if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
37
			Gradient grad = (Gradient) engine.convert(value, Gradient.class, control.getDisplay());
38
			CTabFolder folder = ((CTabFolder) control);
39
			Color[] colors = CSSSWTColorHelper.getSWTColors(grad, folder.getDisplay(), engine);
40
			int[] percents = CSSSWTColorHelper.getPercents(grad);
41
			folder.setSelectionBackground(colors, percents, true);
42
		}
43
	}
44
	
45
46
	@Override
47
	protected String retrieveCSSProperty(Control control, String property,
48
			String pseudo, CSSEngine engine) throws Exception {
49
		// TODO Auto-generated method stub
50
		return null;
51
	}
52
53
}

Return to bug 320784