Bug 156747 Adopt Resource.getDevice() in the JFace resource managers
SWT has recently added a Resource.getDevice() method. This allows several improvements to be made to the JFace resource managers: 1. The (inefficient and complex) heuristics that detect a device by creating temporary resources can be removed. 2. The one-argument descriptor factories that don't take a Device can be made just as efficient as the two-argument versions. 3. The descriptor factory methods that take a Device can be deprecated, since the second argument is no longer required and the one-argument version is just as efficient.
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorDescriptor.java
* @param device SWT device on which to allocate the Color
     * @return a newly allocated SWT Color object (never null)
     * @throws DeviceResourceException if unable to allocate the Color
     */
    public abstract Color createColor(Device device) throws DeviceResourceException;
    
    /**
     * Undoes whatever was done by createColor. 
     * 
     * @since 3.1 
     *
     * @param toDestroy a Color that was previously allocated by an equal ColorDescriptor
     */
    public abstract void destroyColor(Color toDestroy);
    
    /* (non-Javadoc)
     * @see org.eclipse.jface.resource.DeviceResourceDescriptor#createResource(org.eclipse.swt.graphics.Device)
     */
    public final Object createResource(Device device) throws DeviceResourceException {
        return createColor(device);
    }
    
    /* (non-Javadoc)
     * @see org.eclipse.jface.resource.DeviceResourceDescriptor#destroyResource(java.lang.Object)
     */
    public final void destroyResource(Object previouslyCreatedObject) {
        destroyColor((Color)previouslyCreatedObject);
    }
}