Bug 374485 - [CSS] Theme exception when starting up an Eclipse4 App
Summary: [CSS] Theme exception when starting up an Eclipse4 App
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2.2   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-16 08:44 EDT by Paul Webster CLA
Modified: 2016-09-29 10:35 EDT (History)
3 users (show)

See Also:
pwebster: review+


Attachments
Patch for EditorPrefPage (2.77 KB, patch)
2013-01-15 10:57 EST, Bogdan Gheorghe CLA
no flags Details | Diff
Patch for ThemeEngine (2.29 KB, patch)
2013-01-15 10:57 EST, Bogdan Gheorghe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Webster CLA 2012-03-16 08:44:51 EDT
I was running my Eclipse4 application from https://github.com/paulweb515/eclipseExamples/tree/master/org.eclipse.example.e4.commands

When I started up I get the following error:

java.net.MalformedURLException
	at java.net.URL.<init>(URL.java:613)
	at java.net.URL.<init>(URL.java:476)
	at java.net.URL.<init>(URL.java:425)
	at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.parseStyleSheet(AbstractCSSEngine.java:199)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:365)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:336)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:318)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.restore(ThemeEngine.java:477)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.initializeStyling(PartRenderingEngine.java:1126)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:913)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:910)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:85)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:147)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Comment 1 Paul Webster CLA 2012-03-16 08:59:24 EDT
Because my SDK has customized the CSS, I have a $HOME/.e4css directory.

When we call engine.parseStyleSheet(*) on file:/C:/Users/Paul/.e4css/e4_default_win7.css

We calculate the import as file:/C:/Users/Paul/.e4css/e4_basestyle.css

We can't find it.  So we look for defaults, and we get to org.eclipse.e4.ui.css.core.util.impl.resources.OSGiResourceLocator.resolve(String) which has a hard-coded startLocation:  platform:/plugin/org.eclipse.platform/css/

Except all my themes were provided in org.eclipse.example.e4.commands

PW
Comment 2 Paul Webster CLA 2012-03-16 09:10:31 EDT
org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.ThemeEngine(Display) contains code to register the OSGiResourceLocator, but it seems to involve extension point elements not defined in the themes EP schema.

PW
Comment 3 Paul Webster CLA 2012-03-20 09:18:49 EDT
We should look at writing the customized CSS to the configuration area of the running app as well.  That way, an SDK install won't interfere with any of the RCP apps, or different SDK installs.


org.eclipse.core.runtime.Platform.getConfigurationLocation() is a convenience method to get the configuration Location.

Then maybe FileLocator.toFileURL(location.getDataArea(CSS.PLUGIN_ID))

PW
Comment 4 Bogdan Gheorghe CLA 2012-05-03 14:01:01 EDT
Moving to RC1 to give a bit more time to try out different options.
Comment 5 Paul Webster CLA 2013-01-11 14:02:58 EST
Defered to 4.3
Comment 6 Bogdan Gheorghe CLA 2013-01-15 10:57:02 EST
Created attachment 225639 [details]
Patch for EditorPrefPage
Comment 7 Bogdan Gheorghe CLA 2013-01-15 10:57:58 EST
Created attachment 225640 [details]
Patch for ThemeEngine
Comment 8 Paul Webster CLA 2013-01-15 13:42:13 EST
Could you include a copy-contents step from the current user.home/.e4css ?  Otherwise people's edits from SR1 will be lost in the upgrade.

Other than that, it looks good.

PW
Comment 9 Paul Webster CLA 2013-01-16 16:11:32 EST
I hit a snag in 4.2.2, I pushed http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_2_maintenance&id=8f14292377e08c6f5df1adca0ecb798852e29e13 to fix some version numbers.

PW
Comment 10 Paul Webster CLA 2013-01-24 10:34:05 EST
.