Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[e4-dev] Resource Management made easy

Hi,

Some weeks ago I introduced an easy to use Resource-handling
infrastructure in my modeltooling which has the following features for
users:
a) Resource pooling (how can I share resources)
b) Resource manageing (when do I free resources)

The main idea behind it is that every (MPart)-context has an
IResourcePool which is backed by an Display-wide shared
Native-Resource-Pool (Image,Font,Color) and which uses Ref-Counting to
know when image resources can be released.

The IResourcePool gets created by DI when using it like this:

----------8<----------
@Inject
private IResourcePool resourcePool;

// ....
Image img = resource.getImage(ResourceProvider.IMG_Addons);
----------8<----------

and disposed when the context of who created it is destroyed (e.g. when
the part is closed). This removes the need for the developer to manage
resource him/herself but our DI-Framework cleans it up magically.

The creation and publishing of available resources is done OSGi-Services
and filters e.g. using DS:
----------8<----------
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0";
name="org.eclipse.e4.tools.emf.ui.resourceprovider">
   <implementation
class="org.eclipse.e4.tools.emf.ui.internal.ResourceProvider"/>
   <service>
      <provide
interface="org.eclipse.e4.tools.services.IResourceProviderService"/>
   </service>
   <properties entry="OSGI-INF/images.properties"/>
</scr:component>
----------8<----------

Do people think such a service would be helpful in the core-ui-framework?

Tom

-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                                        geschaeftsfuehrer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5/1    A-6020 innsbruck      phone    ++43 512 935834


Back to the top