public final class LocalResourceManager extends ResourceManager
A nested registry can be used to manage the resources for, say, a dialog box.
Constructor and Description |
---|
LocalResourceManager(ResourceManager parentRegistry)
Creates a local registry that delegates to the given global registry
for all resource allocation and deallocation.
|
LocalResourceManager(ResourceManager parentRegistry,
Control owner)
Creates a local registry that wraps the given global registry.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
allocate(DeviceResourceDescriptor descriptor)
Called the first time a resource is requested.
|
Object |
create(DeviceResourceDescriptor descriptor)
Returns the resource described by the given descriptor.
|
protected void |
deallocate(Object resource,
DeviceResourceDescriptor descriptor)
Called the last time a resource is dereferenced.
|
void |
destroy(DeviceResourceDescriptor descriptor)
Deallocates a resource previously allocated by create(...).
|
void |
dispose()
Deallocates any resources allocated by this registry that have not yet been
deallocated.
|
Object |
find(DeviceResourceDescriptor descriptor)
Returns a previously allocated resource associated with the given descriptor, or
null if none exists yet.
|
protected Image |
getDefaultImage()
Returns the default image that will be returned in the event that the intended
image is missing.
|
Device |
getDevice()
Returns the Device for which this ResourceManager will create resources
|
cancelDisposeExec, createColor, createColor, createFont, createImage, createImageWithDefault, destroyColor, destroyColor, destroyFont, destroyImage, disposeExec
public LocalResourceManager(ResourceManager parentRegistry)
parentRegistry
- global registrypublic LocalResourceManager(ResourceManager parentRegistry, Control owner)
parentRegistry
- global registry that handles resource allocationowner
- control whose disposal will trigger cleanup of everything
in the registry.public Device getDevice()
ResourceManager
getDevice
in class ResourceManager
protected Object allocate(DeviceResourceDescriptor descriptor) throws DeviceResourceException
descriptor
- identifier for the resource to allocateDeviceResourceException
protected void deallocate(Object resource, DeviceResourceDescriptor descriptor)
resource
- resource being deallocateddescriptor
- identifier for the resourceprotected Image getDefaultImage()
ResourceManager
getDefaultImage
in class ResourceManager
public final Object create(DeviceResourceDescriptor descriptor) throws DeviceResourceException
ResourceManager
create
in class ResourceManager
descriptor
- descriptor for the resource to allocateDeviceResourceException
- if unable to allocate the resourcepublic final void destroy(DeviceResourceDescriptor descriptor)
ResourceManager
destroy
in class ResourceManager
descriptor
- identifier for the resourcepublic void dispose()
dispose
in class ResourceManager
public Object find(DeviceResourceDescriptor descriptor)
ResourceManager
find
in class ResourceManager
descriptor
- descriptor to findGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.