Project: Eclipse_Platform_UI
Bug 58315 AbstractUIPlugin#getImageRegistry not usable
Reported: 2004-04-13 11:46:17 | Status: verified fixed

The concept of AbstractUIPlugin#getImageRegistry should be reworked now new API is available. 1. The default constructor of ImageRegistry uses Display.getCurrent() without checking if the thread is valid. 2. AbstractUIPlugin#createImageRegistry invokes default constructor of ImageRegistry but doesn't ensure the UI thread is used (throws exception). 3. If the constructor ImageRegistry(Display) is used, the #hookDisplayDispose doesn't ensure the right thread is used (throws exception) Example: When accessing the image registry for the first time from within a lightwight decorator (my example) the thread is different (not the ui thread). Possible Solution: 1. Modify ImageRegistry#hookDisplayDispose to get executed inside the thread of the display 2. Modify AbstractUIPlugin#createImageRegistry to call ImageRegistry(Display) with the display obtained from the workbench (AbstractUIPlugin#getWorkbench#getDisplay)

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java