01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.resource;
11:
12: import org.eclipse.swt.graphics.Device;
13:
14: /**
15: * Instances of this class can allocate and dispose SWT resources. Each
16: * instance describes a particular resource (such as a Color, Font, or Image)
17: * and can create and destroy that resource on demand. DeviceResourceDescriptors
18: * are managed by a ResourceRegistry.
19: *
20: * @see org.eclipse.jface.resource.ResourceManager
21: *
22: * @since 3.1
23: */
24: public abstract class DeviceResourceDescriptor {
25: /**
26: * Creates the resource described by this descriptor
27: *
28: * @since 3.1
29: *
30: * @param device the Device on which to allocate the resource
31: * @return the newly allocated resource (not null)
32: * @throws DeviceResourceException if unable to allocate the resource
33: */
34: public abstract Object createResource(Device device);
35:
36: /**
37: * Undoes everything that was done by a previous call to create(...), given
38: * the object that was returned by create(...).
39: *
40: * @since 3.1
41: *
42: * @param previouslyCreatedObject an object that was returned by an equal
43: * descriptor in a previous call to createResource(...).
44: */
45: public abstract void destroyResource(Object previouslyCreatedObject);
46: }
|