Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » CSS styling with e4
CSS styling with e4 [message #539096] Wed, 09 June 2010 15:42 Go to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi,

I have a problem applying the default.css to my application.

I added the extension property into my plugin.xml:

 <property
               name="applicationCSS"
               value="platform:/plugin/org.eclipse.custom.rover.client/css/default.css">
         </property>


I modified my css but I still get the default styles within eclipse.
After that I tried injecting the IStyleEngine into my view and style the buttons with it. Had no effect on my application.

The only way it seems to work is assigning a menu and a handler and have the handler change the style for the whole application.

From the tutorial however I understood that the default css assigned in the plugin.xml should be loaded automatically.
Is there anything I am missing? Unfortunately I did not find anything that helps me.

I didn't find a bug report about neither the IStyleEngine (that seemed to have worked in the past) nor about the default.css that isn't loading.

Sincerely,
Artur
Re: CSS styling with e4 [message #539099 is a reply to message #539096] Wed, 09 June 2010 15:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6600
Registered: July 2009
Senior Member
This has changed and you now need to define a Theme using the
CSS-Theme-Extension point and the value in applicationCSS is the default
theme-id.

Tom

Am 09.06.10 17:42, schrieb Artur Kronenberg:
> Hi,
>
> I have a problem applying the default.css to my application.
>
> I added the extension property into my plugin.xml:
>
> <property
> name="applicationCSS"
>
> value=" platform:/plugin/org.eclipse.custom.rover.client/css/default .css ">
> </property>
>
> I modified my css but I still get the default styles within eclipse.
> After that I tried injecting the IStyleEngine into my view and style the
> buttons with it. Had no effect on my application.
>
> The only way it seems to work is assigning a menu and a handler and have
> the handler change the style for the whole application.
> From the tutorial however I understood that the default css assigned in
> the plugin.xml should be loaded automatically.
> Is there anything I am missing? Unfortunately I did not find anything
> that helps me.
> I didn't find a bug report about neither the IStyleEngine (that seemed
> to have worked in the past) nor about the default.css that isn't loading.
> Sincerely,
> Artur
Re: CSS styling with e4 [message #539108 is a reply to message #539099] Wed, 09 June 2010 15:48 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6600
Registered: July 2009
Senior Member
http://dev.eclipse.org/viewcvs/index.cgi/e4/org.eclipse.e4.u i/examples/org.eclipse.e4.demo.simpleide/plugin.xml?view=mar kup

We should rename the configuration value to applicationTheme probably.

Tom

Am 09.06.10 17:46, schrieb Tom Schindl:
> This has changed and you now need to define a Theme using the
> CSS-Theme-Extension point and the value in applicationCSS is the default
> theme-id.
>
> Tom
>
> Am 09.06.10 17:42, schrieb Artur Kronenberg:
>> Hi,
>>
>> I have a problem applying the default.css to my application.
>>
>> I added the extension property into my plugin.xml:
>>
>> <property
>> name="applicationCSS"
>>
>> value=" platform:/plugin/org.eclipse.custom.rover.client/css/default .css ">
>> </property>
>>
>> I modified my css but I still get the default styles within eclipse.
>> After that I tried injecting the IStyleEngine into my view and style the
>> buttons with it. Had no effect on my application.
>>
>> The only way it seems to work is assigning a menu and a handler and have
>> the handler change the style for the whole application.
>> From the tutorial however I understood that the default css assigned in
>> the plugin.xml should be loaded automatically.
>> Is there anything I am missing? Unfortunately I did not find anything
>> that helps me.
>> I didn't find a bug report about neither the IStyleEngine (that seemed
>> to have worked in the past) nor about the default.css that isn't loading.
>> Sincerely,
>> Artur
>
Re: CSS styling with e4 [message #539605 is a reply to message #539108] Fri, 11 June 2010 13:29 Go to previous messageGo to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hey Tom,

thanks for your help. Everything worked fine, but I have another problem with the css.

I am trying to apply a background image to a button im the css. I am doing it like that:

Button.style {
    background-image: url(image.png);
}



So this did not work, no matter how I modified the path. I tried every way I could think of and always got an IllegalArgumentException by SWT saying that my argument was null.

I did some debugging and found this code:
public String resolve(String uri) {
		if (StringUtils.isEmpty(uri))
			return null;
		if (uriResolvers == null)
			return null;
		// Loop for IResourceLocator registered and return the uri resolved
		// as soon as an IResourceLocator return an uri resolved which is not
		// null.
		for (Iterator iterator = uriResolvers.iterator(); iterator.hasNext();) {
			IResourceLocator resolver = (IResourceLocator) iterator.next();
			String s = resolver.resolve(uri);
			if (s != null)
				return s;
		}
		return null;
	}


This is called when starting my application in order to resolve the given uri. There is always just one uriResolver in the class and the resolve method looks like that:
	public String resolve(String uri) {
		if (uri.startsWith("http"))
			return uri;
		return null;
	}


It seems like the only url that can be resolved is a url that starts with http. I added an http address to my css file and my image got resolved and inserted into the button.

I am not sure how to specify normal file images in my application here. can you help me with that? Is it intended that only the one class is registered as an resolver there?

Kind regards,
Artur
Re: CSS styling with e4 [message #539619 is a reply to message #539605] Fri, 11 June 2010 13:39 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6600
Registered: July 2009
Senior Member
Hi,

You can register an OSGI-Resource-Resolver through this in your plugin.xml

----------8<----------
<property
name="applicationCSSResources"

value="platform:/plugin/org.eclipse.e4.demo.simpleide/icons/css/ ">
</property>
----------8<----------

Now relative URLs will be searched in this path :-)

Tom


Am 11.06.10 15:29, schrieb Artur Kronenberg:
> Hey Tom,
>
> thanks for your help. Everything worked fine, but I have another problem
> with the css.
>
> I am trying to apply a background image to a button im the css. I am
> doing it like that:
>
>
> Button.style {
> background-image: url(image.png);
> }
>
>
>
> So this did not work, no matter how I modified the path. I tried every
> way I could think of and always got an IllegalArgumentException by SWT
> saying that my argument was null.
>
> I did some debugging and found this code:
> public String resolve(String uri) {
> if (StringUtils.isEmpty(uri))
> return null;
> if (uriResolvers == null)
> return null;
> // Loop for IResourceLocator registered and return the uri resolved
> // as soon as an IResourceLocator return an uri resolved which
> is not
> // null.
> for (Iterator iterator = uriResolvers.iterator();
> iterator.hasNext();) {
> IResourceLocator resolver = (IResourceLocator) iterator.next();
> String s = resolver.resolve(uri);
> if (s != null)
> return s;
> }
> return null;
> }
>
> This is called when starting my application in order to resolve the
> given uri. There is always just one uriResolver in the class and the
> resolve method looks like that:
> public String resolve(String uri) {
> if (uri.startsWith("http"))
> return uri;
> return null;
> }
>
> It seems like the only url that can be resolved is a url that starts
> with http. I added an http address to my css file and my image got
> resolved and inserted into the button.
>
> I am not sure how to specify normal file images in my application here.
> can you help me with that? Is it intended that only the one class is
> registered as an resolver there?
>
> Kind regards,
> Artur
>
Re: CSS styling with e4 [message #577308 is a reply to message #539096] Wed, 09 June 2010 15:46 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6600
Registered: July 2009
Senior Member
This has changed and you now need to define a Theme using the
CSS-Theme-Extension point and the value in applicationCSS is the default
theme-id.

Tom

Am 09.06.10 17:42, schrieb Artur Kronenberg:
> Hi,
>
> I have a problem applying the default.css to my application.
>
> I added the extension property into my plugin.xml:
>
> <property
> name="applicationCSS"
>
> value=" platform:/plugin/org.eclipse.custom.rover.client/css/default .css ">
> </property>
>
> I modified my css but I still get the default styles within eclipse.
> After that I tried injecting the IStyleEngine into my view and style the
> buttons with it. Had no effect on my application.
>
> The only way it seems to work is assigning a menu and a handler and have
> the handler change the style for the whole application.
> From the tutorial however I understood that the default css assigned in
> the plugin.xml should be loaded automatically.
> Is there anything I am missing? Unfortunately I did not find anything
> that helps me.
> I didn't find a bug report about neither the IStyleEngine (that seemed
> to have worked in the past) nor about the default.css that isn't loading.
> Sincerely,
> Artur
Re: CSS styling with e4 [message #577333 is a reply to message #539099] Wed, 09 June 2010 15:48 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6600
Registered: July 2009
Senior Member
http://dev.eclipse.org/viewcvs/index.cgi/e4/org.eclipse.e4.u i/examples/org.eclipse.e4.demo.simpleide/plugin.xml?view=mar kup

We should rename the configuration value to applicationTheme probably.

Tom

Am 09.06.10 17:46, schrieb Tom Schindl:
> This has changed and you now need to define a Theme using the
> CSS-Theme-Extension point and the value in applicationCSS is the default
> theme-id.
>
> Tom
>
> Am 09.06.10 17:42, schrieb Artur Kronenberg:
>> Hi,
>>
>> I have a problem applying the default.css to my application.
>>
>> I added the extension property into my plugin.xml:
>>
>> <property
>> name="applicationCSS"
>>
>> value=" platform:/plugin/org.eclipse.custom.rover.client/css/default .css ">
>> </property>
>>
>> I modified my css but I still get the default styles within eclipse.
>> After that I tried injecting the IStyleEngine into my view and style the
>> buttons with it. Had no effect on my application.
>>
>> The only way it seems to work is assigning a menu and a handler and have
>> the handler change the style for the whole application.
>> From the tutorial however I understood that the default css assigned in
>> the plugin.xml should be loaded automatically.
>> Is there anything I am missing? Unfortunately I did not find anything
>> that helps me.
>> I didn't find a bug report about neither the IStyleEngine (that seemed
>> to have worked in the past) nor about the default.css that isn't loading.
>> Sincerely,
>> Artur
>
Re: CSS styling with e4 [message #577445 is a reply to message #539108] Fri, 11 June 2010 13:29 Go to previous message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hey Tom,

thanks for your help. Everything worked fine, but I have another problem with the css.

I am trying to apply a background image to a button im the css. I am doing it like that:


Button.style {
background-image: url(image.png);
}



So this did not work, no matter how I modified the path. I tried every way I could think of and always got an IllegalArgumentException by SWT saying that my argument was null.

I did some debugging and found this code:
public String resolve(String uri) {
if (StringUtils.isEmpty(uri))
return null;
if (uriResolvers == null)
return null;
// Loop for IResourceLocator registered and return the uri resolved
// as soon as an IResourceLocator return an uri resolved which is not
// null.
for (Iterator iterator = uriResolvers.iterator(); iterator.hasNext();) {
IResourceLocator resolver = (IResourceLocator) iterator.next();
String s = resolver.resolve(uri);
if (s != null)
return s;
}
return null;
}

This is called when starting my application in order to resolve the given uri. There is always just one uriResolver in the class and the resolve method looks like that:
public String resolve(String uri) {
if (uri.startsWith("http"))
return uri;
return null;
}

It seems like the only url that can be resolved is a url that starts with http. I added an http address to my css file and my image got resolved and inserted into the button.

I am not sure how to specify normal file images in my application here. can you help me with that? Is it intended that only the one class is registered as an resolver there?

Kind regards,
Artur
Re: CSS styling with e4 [message #577495 is a reply to message #539605] Fri, 11 June 2010 13:39 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6600
Registered: July 2009
Senior Member
Hi,

You can register an OSGI-Resource-Resolver through this in your plugin.xml

----------8<----------
<property
name="applicationCSSResources"

value="platform:/plugin/org.eclipse.e4.demo.simpleide/icons/css/ ">
</property>
----------8<----------

Now relative URLs will be searched in this path :-)

Tom


Am 11.06.10 15:29, schrieb Artur Kronenberg:
> Hey Tom,
>
> thanks for your help. Everything worked fine, but I have another problem
> with the css.
>
> I am trying to apply a background image to a button im the css. I am
> doing it like that:
>
>
> Button.style {
> background-image: url(image.png);
> }
>
>
>
> So this did not work, no matter how I modified the path. I tried every
> way I could think of and always got an IllegalArgumentException by SWT
> saying that my argument was null.
>
> I did some debugging and found this code:
> public String resolve(String uri) {
> if (StringUtils.isEmpty(uri))
> return null;
> if (uriResolvers == null)
> return null;
> // Loop for IResourceLocator registered and return the uri resolved
> // as soon as an IResourceLocator return an uri resolved which
> is not
> // null.
> for (Iterator iterator = uriResolvers.iterator();
> iterator.hasNext();) {
> IResourceLocator resolver = (IResourceLocator) iterator.next();
> String s = resolver.resolve(uri);
> if (s != null)
> return s;
> }
> return null;
> }
>
> This is called when starting my application in order to resolve the
> given uri. There is always just one uriResolver in the class and the
> resolve method looks like that:
> public String resolve(String uri) {
> if (uri.startsWith("http"))
> return uri;
> return null;
> }
>
> It seems like the only url that can be resolved is a url that starts
> with http. I added an http address to my css file and my image got
> resolved and inserted into the button.
>
> I am not sure how to specify normal file images in my application here.
> can you help me with that? Is it intended that only the one class is
> registered as an resolver there?
>
> Kind regards,
> Artur
>
Previous Topic:XWT on Eclipse 3.5.2
Next Topic:Re: Extensions broken in e4?
Goto Forum:
  


Current Time: Tue Jul 27 03:31:37 GMT 2021

Powered by FUDForum. Page generated in 0.02600 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top