|
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 |
|