Method SummaryModifier and TypeMethodDescription
<R> RReturns the resource described by the given descriptor.
<R> voidDeallocates a resource previously allocated by
<R> RReturns a previously allocated resource associated with the given descriptor, or null if none exists yet.
protected ImageReturns the default image that will be returned in the event that the intended image is missing.Returns the Device for which this ResourceManager will create resources
Methods inherited from class org.eclipse.jface.resource.ResourceManager
cancelDisposeExec, createColor, createColor, createFont, createImage, createImageWithDefault, destroyColor, destroyColor, destroyFont, destroyImage, dispose, disposeExec, get
(int cacheSize, ResourceManager parent)
cacheSize- the lru cache size
getDevicepublic Device getDevice()Returns the Device for which this ResourceManager will create resources
getDefaultImageprotected Image getDefaultImage()Returns the default image that will be returned in the event that the intended image is missing.
createpublic <R> R create
(DeviceResourceDescriptor<R> descriptor)Returns the resource described by the given descriptor. If the resource already exists, the reference count is incremented and the exiting resource is returned. Otherwise, a new resource is allocated. Every call to this method should have a corresponding call to
If the resource is intended to live for entire lifetime of this resource-manager, a subsequent call to
ResourceManager.destroy(DeviceResourceDescriptor)may be omitted and the resource will be cleaned up when this resource-manager is disposed. This pattern is useful for short-lived
LocalResourceManagers, but should never be used with the global resource-manager since doing so effectively leaks the resource.
The resources returned from this method are reference counted and may be shared internally with other resource-managers. They should never be disposed outside of the ResourceManager framework, or it will cause exceptions in other code that shares them. For example, never call
Resource.dispose()on anything returned from this method.
destroypublic <R> void destroy
(DeviceResourceDescriptor<R> descriptor)Deallocates a resource previously allocated by
ResourceManager.create(DeviceResourceDescriptor). Descriptors are compared by equality, not identity. If the same resource was created multiple times, this may decrement a reference count rather than disposing the actual resource.
findpublic <R> R find
(DeviceResourceDescriptor<R> descriptor)Returns a previously allocated resource associated with the given descriptor, or null if none exists yet.