Bug 79909 [JFace] Localized resource registries for JFace
Please provide improved JFace support for managing SWT resources, with the following properties: - A registry can allocate and deallocate SWT resources given a descriptor - Resources are reference-counted and shared, allowing different objects with equivalent descriptors to share resources. - Everything in the registry can be deallocated with one function call - The registry should support an open-ended set of resources (and should initially support, at minimum, Images, Fonts, Colors) - It should be possible to create a "local registry" that behaves like a regular registry but actually shares its resources with a global registry. For example, the workbench could offer a local registry as a service to views and editors. This would allow views and editors to safely allocate and deallocate SWT resources without any chance of leaking.
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
* @see org.eclipse.swt.widgets.Display#getCurrent()
     */
    public ColorRegistry() {
        this(Display.getCurrent(), true);
    }
    /**
     * Create a new instance of the receiver.
     * 
     * @param display the <code>Display</code> to hook into.
     */
    public ColorRegistry(Display display) {
    	this (display, true);
    }
    /**
     * Create a new instance of the receiver.
     * 
     * @param display the <code>Display</code> to hook into
     * @param cleanOnDisplayDisposal
	 *            whether all fonts allocated by this <code>ColorRegistry</code>
	 *            should be disposed when the display is disposed
     * @since 3.1
     */
    public ColorRegistry(Display display, boolean cleanOnDisplayDisposal) {
        Assert.isNotNull(display);
        this.display = display;
        if (cleanOnDisplayDisposal)
        	hookDisplayDispose();
    }
    /**
     * Create a new <code>Color</code> on the receivers <code>Display</code>.