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 277471
Collapse All | Expand All

(-)src/org/eclipse/e4/ui/workbench/swt/internal/WorkbenchApplication.java (-1 / +4 lines)
Lines 54-59 Link Here
54
		}
54
		}
55
		final String cssURI = product == null ? null : product
55
		final String cssURI = product == null ? null : product
56
				.getProperty("applicationCSS"); //$NON-NLS-1$;
56
				.getProperty("applicationCSS"); //$NON-NLS-1$;
57
		final String cssResourcesURI = product == null ? null : product
58
				.getProperty("applicationCSSResources"); //$NON-NLS-1$;
59
57
		Assert.isNotNull(appURI, "-applicationXMI argument missing"); //$NON-NLS-1$
60
		Assert.isNotNull(appURI, "-applicationXMI argument missing"); //$NON-NLS-1$
58
		final URI initialWorkbenchDefinitionInstance = URI
61
		final URI initialWorkbenchDefinitionInstance = URI
59
				.createPlatformPluginURI(appURI, true);
62
				.createPlatformPluginURI(appURI, true);
Lines 75-81 Link Here
75
									.getBundleAdmin()));
78
									.getBundleAdmin()));
76
					if (cssURI != null) {
79
					if (cssURI != null) {
77
						WorkbenchStylingSupport.initializeStyling(display,
80
						WorkbenchStylingSupport.initializeStyling(display,
78
								cssURI, appContext);
81
								cssURI, cssResourcesURI, appContext);
79
					} else {
82
					} else {
80
						WorkbenchStylingSupport
83
						WorkbenchStylingSupport
81
								.initializeNullStyling(appContext);
84
								.initializeNullStyling(appContext);
(-)src/org/eclipse/e4/ui/workbench/swt/internal/WorkbenchStylingSupport.java (-1 / +32 lines)
Lines 29-35 Link Here
29
public class WorkbenchStylingSupport {
29
public class WorkbenchStylingSupport {
30
30
31
	public static void initializeStyling(Display display, String cssURI,
31
	public static void initializeStyling(Display display, String cssURI,
32
			IEclipseContext appContext) {
32
			String resourceURI, IEclipseContext appContext) {
33
		// Instantiate SWT CSS Engine
33
		// Instantiate SWT CSS Engine
34
		try {
34
		try {
35
			Class engineClass = Class
35
			Class engineClass = Class
Lines 49-54 Link Here
49
			setErrorHandler.invoke(engine, new Object[] { errorHandlerImplClass
49
			setErrorHandler.invoke(engine, new Object[] { errorHandlerImplClass
50
					.newInstance() });
50
					.newInstance() });
51
51
52
			// Create the OSGi resource locator
53
54
			if (resourceURI != null) {
55
				Class resourceLocatorClass = Class
56
						.forName("org.eclipse.e4.ui.css.core.util.impl.resources.OSGiResourceLocator"); //$NON-NLS-1$
57
				Constructor resourceLocatorConst = resourceLocatorClass
58
						.getConstructor(new Class[] { String.class });
59
				final Object resourceLocator = resourceLocatorConst
60
						.newInstance(new Object[] { resourceURI.toString() });
61
				display.setData(
62
						"org.eclipse.e4.ui.css.core.resourceURL", resourceURI); //$NON-NLS-1$		
63
64
				// engine.getResourcesLocatorManager().registerResourceLocator(IResourceLocator);
65
				Method getResourcesLocatorManagerMethod = engineClass
66
						.getMethod("getResourcesLocatorManager", new Class[] {}); //$NON-NLS-1$
67
				Object resourceRegistryManager = getResourcesLocatorManagerMethod
68
						.invoke(engine, new Object[] {});
69
70
				Class iResourceLocatorClass = Class
71
						.forName("org.eclipse.e4.ui.css.core.util.resources.IResourceLocator"); //$NON-NLS-1$
72
73
				Method registerResourceLocatorMethod = resourceRegistryManager
74
						.getClass()
75
						.getMethod(
76
								"registerResourceLocator", new Class[] { iResourceLocatorClass }); //$NON-NLS-1$
77
				registerResourceLocatorMethod.invoke(resourceRegistryManager,
78
						new Object[] { resourceLocator });
79
			}
80
81
			// Lookup the style sheet
82
52
			URL url = FileLocator.resolve(new URL(cssURI.toString()));
83
			URL url = FileLocator.resolve(new URL(cssURI.toString()));
53
			display.setData("org.eclipse.e4.ui.css.core.cssURL", url); //$NON-NLS-1$		
84
			display.setData("org.eclipse.e4.ui.css.core.cssURL", url); //$NON-NLS-1$		
54
85
(-)src/org/eclipse/ui/internal/Workbench.java (-1 / +3 lines)
Lines 1379-1387 Link Here
1379
		IProduct product = Platform.getProduct();
1379
		IProduct product = Platform.getProduct();
1380
		final String cssURI = product == null ? null : product
1380
		final String cssURI = product == null ? null : product
1381
				.getProperty("applicationCSS"); //$NON-NLS-1$;
1381
				.getProperty("applicationCSS"); //$NON-NLS-1$;
1382
		final String cssResourcesURI = product == null ? null : product
1383
				.getProperty("applicationCSSResources"); //$NON-NLS-1$;
1382
		if (cssURI != null) {
1384
		if (cssURI != null) {
1383
			WorkbenchStylingSupport.initializeStyling(display, cssURI,
1385
			WorkbenchStylingSupport.initializeStyling(display, cssURI,
1384
					e4Context);
1386
					cssResourcesURI, e4Context);
1385
		} else {
1387
		} else {
1386
			WorkbenchStylingSupport.initializeNullStyling(e4Context);
1388
			WorkbenchStylingSupport.initializeNullStyling(e4Context);
1387
		}
1389
		}
(-)css/e4photo.css (+1 lines)
Lines 70-75 Link Here
70
Tree {
70
Tree {
71
	font: Verdana 8px;
71
	font: Verdana 8px;
72
	color: #666666;
72
	color: #666666;
73
	background: url(bluefade-full.gif);		
73
}
74
}
74
75
75
Composite Shell {
76
Composite Shell {
(-)plugin.xml (+4 lines)
Lines 66-71 Link Here
66
               name="applicationCSS"
66
               name="applicationCSS"
67
               value="platform:/plugin/org.eclipse.e4.demo.e4photo/css/e4photo.css">
67
               value="platform:/plugin/org.eclipse.e4.demo.e4photo/css/e4photo.css">
68
         </property>
68
         </property>
69
         <property
70
               name="applicationCSSResources"
71
               value="platform:/plugin/org.eclipse.e4.demo.e4photo/images/">
72
         </property>
69
      </product>
73
      </product>
70
   </extension>
74
   </extension>
71
75
(-)src/org/eclipse/e4/ui/examples/css/editor/AbstractCSSSWTEditor.java (-1 / +7 lines)
Lines 17-24 Link Here
17
import org.eclipse.e4.ui.css.core.dom.IElementProvider;
17
import org.eclipse.e4.ui.css.core.dom.IElementProvider;
18
import org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties;
18
import org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties;
19
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
19
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
20
import org.eclipse.e4.ui.examples.css.Activator;
20
import org.eclipse.e4.ui.examples.css.editor.AbstractCSSEditor;
21
import org.eclipse.e4.ui.examples.css.editor.AbstractCSSEditor;
21
import org.eclipse.e4.ui.css.core.serializers.CSSSerializerConfiguration;
22
import org.eclipse.e4.ui.css.core.serializers.CSSSerializerConfiguration;
23
import org.eclipse.e4.ui.css.core.util.impl.resources.FileResourcesLocatorImpl;
24
import org.eclipse.e4.ui.css.core.util.impl.resources.OSGiResourceLocator;
22
import org.eclipse.e4.ui.css.swt.dom.SWTElementProvider;
25
import org.eclipse.e4.ui.css.swt.dom.SWTElementProvider;
23
import org.eclipse.e4.ui.css.swt.dom.html.SWTHTMLElementProvider;
26
import org.eclipse.e4.ui.css.swt.dom.html.SWTHTMLElementProvider;
24
import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl;
27
import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl;
Lines 527-533 Link Here
527
	 * @see org.eclipse.e4.ui.core.css.examples.csseditors.AbstractCSSEditor#createCSSEngine()
530
	 * @see org.eclipse.e4.ui.core.css.examples.csseditors.AbstractCSSEditor#createCSSEngine()
528
	 */
531
	 */
529
	protected CSSEngine createCSSEngine() {
532
	protected CSSEngine createCSSEngine() {
530
		return new CSSSWTEngineImpl(shell.getDisplay());
533
		CSSEngine engine = new CSSSWTEngineImpl(shell.getDisplay());
534
		engine.getResourcesLocatorManager().registerResourceLocator(
535
				new FileResourcesLocatorImpl());
536
		return engine;
531
	}
537
	}
532
538
533
	/*
539
	/*
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 28-32 Link Here
28
 org.eclipse.e4.ui.css.xml.engine,
28
 org.eclipse.e4.ui.css.xml.engine,
29
 org.eclipse.e4.ui.css.xml.properties.css2
29
 org.eclipse.e4.ui.css.xml.properties.css2
30
Require-Bundle: org.w3c.css.sac;bundle-version="1.3.0",
30
Require-Bundle: org.w3c.css.sac;bundle-version="1.3.0",
31
 org.apache.batik.css;bundle-version="[1.6.0,1.7.0)"
31
 org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
32
 org.eclipse.core.runtime;bundle-version="3.5.0"
32
Bundle-RequiredExecutionEnvironment: J2SE-1.5
33
Bundle-RequiredExecutionEnvironment: J2SE-1.5
(-)src/org/eclipse/e4/ui/css/core/util/impl/resources/ResourcesLocatorManager.java (-1 lines)
Lines 37-43 Link Here
37
37
38
	public ResourcesLocatorManager() {		
38
	public ResourcesLocatorManager() {		
39
		registerResourceLocator(new HttpResourcesLocatorImpl());
39
		registerResourceLocator(new HttpResourcesLocatorImpl());
40
		registerResourceLocator(new FileResourcesLocatorImpl());
41
	}
40
	}
42
41
43
	/*
42
	/*
(-)src/org/eclipse/e4/ui/css/core/util/impl/resources/OSGiResourceLocator.java (+49 lines)
Added Link Here
1
package org.eclipse.e4.ui.css.core.util.impl.resources;
2
3
import java.io.InputStream;
4
import java.io.InputStreamReader;
5
import java.io.Reader;
6
import java.net.URL;
7
8
import org.eclipse.core.runtime.FileLocator;
9
import org.eclipse.e4.ui.css.core.util.resources.IResourceLocator;
10
11
public class OSGiResourceLocator implements IResourceLocator {
12
	
13
	private String startLocation;
14
15
	public OSGiResourceLocator(String start) {
16
		startLocation = start;
17
	}
18
	
19
	/*
20
	 * (non-Javadoc)
21
	 * 
22
	 * @see org.eclipse.e4.ui.css.core.util.resources.IURIResolver#resolve(java.lang.String)
23
	 */
24
	public String resolve(String uri) {
25
		return uri;
26
	}
27
28
	/*
29
	 * (non-Javadoc)
30
	 * 
31
	 * @see org.eclipse.e4.ui.css.core.util.resources.IResourceLocator#getInputStream(java.lang.String)
32
	 */
33
	public InputStream getInputStream(String uri) throws Exception {
34
		return FileLocator.resolve(
35
					new URL(startLocation + uri)
36
				).openStream();
37
	}
38
39
	/*
40
	 * (non-Javadoc)
41
	 * 
42
	 * @see org.eclipse.e4.ui.css.core.util.resources.IResourceLocator#getReader(java.lang.String)
43
	 */
44
	public Reader getReader(String uri) throws Exception {
45
		return new InputStreamReader(getInputStream(uri));
46
	}
47
48
49
}

Return to bug 277471