Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to use IResourcePool
How to use IResourcePool [message #804103] Wed, 22 February 2012 02:47 Go to next message
Watabe Kichi is currently offline Watabe Kichi
Messages: 12
Registered: July 2011
Junior Member
I'd like to know how to use IResourcePool.

I can inject IResourcePool, but don't know how to set resources.

I read the source code.
It seems it (eventually?) calls an OSGi Service and uses IResourceProviderService's properties to get resources.

Do I have to implement IResourceProviderService and it's properties in my app?
Or is there an easy way to set resources?

It would be great if I can get resources from preference setting.
(by Color: rgb,Image: uri, Font: fontname etc)

Thank you in advance. Smile
Re: How to use IResourcePool [message #804126 is a reply to message #804103] Wed, 22 February 2012 03:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5020
Registered: July 2009
Senior Member
Am 22.02.12 08:47, schrieb Watabe Kichi:
> I'd like to know how to use IResourcePool.
>
> I can inject IResourcePool, but don't know how to set resources.
>
> I read the source code.
> It seems it (eventually?) calls an OSGi Service and uses
> IResourceProviderService's properties to get resources.
>
> Do I have to implement IResourceProviderService and it's properties in
> my app?
> Or is there an easy way to set resources?
>

No - currently the only way is to provide an OSGi-Service but you are
free to grab the sources and implement new features, provide a patch and
we can discuss if this feature is feasable.

There is a base class available which you can simply subclass
(BasicResourceProvider) and use DS to contribute.

An example can be found here:

http://git.eclipse.org/c/e4/org.eclipse.e4.tools.git/tree/bundles/org.eclipse.e4.tools.emf.ui

> It would be great if I can get resources from preference setting.
> (by Color: rgb,Image: uri, Font: fontname etc)
>

That would be a nice addition for a base class which queries the
preference store for a value.

Tom
Re: How to use IResourcePool [message #804928 is a reply to message #804126] Thu, 23 February 2012 01:36 Go to previous message
Watabe Kichi is currently offline Watabe Kichi
Messages: 12
Registered: July 2011
Junior Member
Thank you very much for the quick reply.

It seems org.eclipse.e4.tools.emf.ui.internal.ResourceProvider just defines properties as String.
So I made an empty subclass of BasicResourceProvider and set the service's properties entry to preference setting file.

like this,
<properties entry="preferences.ini"/>


I don't know if this is the correct way, but it works for now.
Previous Topic:RCP can not say hello world
Next Topic:HandlerServiceImpl scoping
Goto Forum:
  


Current Time: Thu Apr 24 11:30:55 EDT 2014

Powered by FUDForum. Page generated in 0.02362 seconds