Community
Participate
Working Groups
Build id: I20140218-0800 I added the the org.eclipse.ui.themes plugin (See Bug #420836) to the Run configuration of my RCP application (e3 based but using the compatibility layer). When selecting the dark theme I get: java.net.MalformedURLException at java.net.URL.<init>(URL.java:619) at java.net.URL.<init>(URL.java:482) at java.net.URL.<init>(URL.java:431) at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.parseStyleSheet(AbstractCSSEngine.java:203) at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:421) at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:382) at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.restore(ThemeEngine.java:546) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.initializeStyling(PartRenderingEngine.java:1248) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1009) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1006) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:147) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:620) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:571) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at com.archimatetool.editor.Application.start(Application.java:73) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) Setting a breakpoint on engine.parseStyleSheet(source); I get this URL: platform:/plugin/org.eclipse.ui.themes/css/e4-dark.css
The URL is: file:/C:/dev/eclipse4.4/plugins/org.eclipse.ui.themes_1.0.0.v20140212-1427/css/e4-dark.css
(In reply to Phillipus B from comment #1) > The URL is: > > file:/C:/dev/eclipse4.4/plugins/org.eclipse.ui.themes_1.0.0.v20140212-1427/ > css/e4-dark.css Can you try to use the platform URI? That is what we are using in the platform. See dark theme for an example how to use it.
In AbstractCSSEngine#parseStyleSheet(InputSource source) this is what happens: String path = getResourcesLocatorManager().resolve(((CSSImportRule) rule).getHref()); path is null so the next line fails: testFile = new File(new URL(path).getFile()); and the exception is thrown.
(In reply to Lars Vogel from comment #2) > (In reply to Phillipus B from comment #1) > > The URL is: > > > > file:/C:/dev/eclipse4.4/plugins/org.eclipse.ui.themes_1.0.0.v20140212-1427/ > > css/e4-dark.css > > Can you try to use the platform URI? That is what we are using in the > platform. See dark theme for an example how to use it. Setting a breakpoint on engine.parseStyleSheet(source); I get this URL: platform:/plugin/org.eclipse.ui.themes/css/e4-dark.css I don't do anything special. I get registered themes like this: List<ITheme> themes = fThemeEngine.getThemes(); Get the dark theme and call: fThemeEngine.setTheme(theme, true);
I created my own theme plugin which is a copy of the org.eclipse.ui.themes plugin. I included that in the Run config of my RCP app. Same problem.
If I remove the lines: @import url("platform:/plugin/org.eclipse.platform/css/e4_basestyle.css"); @import url("platform:/plugin/org.eclipse.ui.themes/css/e4-dark-config-parts.css"); from the dark theme it works OK.
So I changed the lines to: @import url(""platform:/plugin/org.eclipse.platform/css/e4_basestyle.css"); @import url("e4-dark-config-parts.css"); And it works OK.
(In reply to Phillipus B from comment #7) > So I changed the lines to: > > @import url(""platform:/plugin/org.eclipse.platform/css/e4_basestyle.css"); > @import url("e4-dark-config-parts.css"); > > And it works OK. Thanks for the testing. Looks like the error is in public StyleSheet parseStyleSheet(InputSource source) throws IOException of AbstractCSSEngine.java I continue to investigate
So, it's my bad. Include org.eclipse.ui.themes org.eclipse.platform in dependencies and it's OK. Sorry to waste your time and the noise. ;-)
(In reply to Phillipus B from comment #9) > So, it's my bad. > > Include > > org.eclipse.ui.themes > org.eclipse.platform Are you saying you had to include org.eclipse.platform to get this plugin to work? That still sounds like there's something wrong with the plugin or themes. PW
Lars, have you been able to reproduce? We still have references to org.eclipse.platform in org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.ThemeEngine(Display) They should probably default to org.eclipse.ui.themes now. PW
(In reply to Phillipus B from comment #9) > So, it's my bad. > > Include > > org.eclipse.ui.themes > org.eclipse.platform > > in dependencies and it's OK. > > Sorry to waste your time and the noise. ;-) Are you using the platform URI for this or the local one?
(In reply to Paul Webster from comment #11) > Lars, have you been able to reproduce? We still have references to > org.eclipse.platform in > org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.ThemeEngine(Display) > They should probably default to org.eclipse.ui.themes now. > Gerrit review for the change of the default, https://git.eclipse.org/r/#/c/22353 I still need to clean this up, it includes the functional change as well as @Override changes.
(In reply to Lars Vogel from comment #13) > (In reply to Paul Webster from comment # https://git.eclipse.org/r/#/c/22353 should be fine now.
(In reply to Paul Webster from comment #10) > (In reply to Phillipus B from comment #9) > > So, it's my bad. > > > > Include > > > > org.eclipse.ui.themes > > org.eclipse.platform > > Are you saying you had to include org.eclipse.platform to get this plugin to > work? That still sounds like there's something wrong with the plugin or > themes. > > PW Yes.
(In reply to Phillipus B from comment #15) > (In reply to Paul Webster from comment #10) > > > org.eclipse.ui.themes > > > org.eclipse.platform > > Are you saying you had to include org.eclipse.platform to get this plugin to > > work? That still sounds like there's something wrong with the plugin or > > themes. > > > > PW > > Yes. I think the processing of the CSS import statements was not considering the situation in which the import specifies the platform:/ URI. Proposed fix: https://git.eclipse.org/r/#/c/22355/
Phillipus, are your familiar enough with the Eclipse platform code to test the change in the Gerrit review? Would be great to see if your Eclipse 3.X example work. I tested with an Eclipse 4 RCP application and the includes work fine for my test scenario. To test this you would clone the eclipse platform repo and apply the Gerrit change on top of it. See http://www.vogella.com/tutorials/Gerrit/article.html for a little introduction into Gerrit.
Thanks for patch. Released as: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=a68ba21575cd6402c83d00781c740ad66bc37a4a Daniel
(In reply to Daniel Rolka from comment #18) > Thanks for patch. Released as: > http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/ > ?id=a68ba21575cd6402c83d00781c740ad66bc37a4a > > Daniel Thanks. As discussed with should remove the default platform URL from the CSS import logic. I updated the other Gerrit review to include that change (depends on this released patch) https://git.eclipse.org/r/#/c/22353
Verified in Build id: I20140303-2000 Created style sheet with only one instruction @import url("platform:/plugin/org.eclipse.ui.themes/css/e4-dark.css"); Added org.eclipse.ui.themes to product and entered the applicationCSS to platform:/plugin/test/css/default.css -> application is "dark"
Verified