If the resource is intended to live for entire lifetime of the resource manager, a subsequent call to {@link #destroy(DeviceResourceDescriptor)} may be omitted and theresource will be cleaned up when the resource manager is disposed. This pattern is useful for short-lived {@link LocalResourceManager}s, 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 {@link org.eclipse.swt.graphics.Resource#dispose()} on anything returned from this method.
Callers may safely downcast the result to the resource type associated with the descriptor. For example, when given an ImageDescriptor, the return value of this method will always be an Image.
@since 3.1 @param descriptor descriptor for the resource to allocate @return the newly allocated resource (not null) @throws DeviceResourceException if unable to allocate the resource
|
|