I know that there are several other threads talking on SWT on No More Handles errors, e.g., SWT No More Handles.
However, I am facing a problem I have when I use a ColumnLabelProvider
for a TableViewer
to provide an Image for each Column of the table using the ColumnLabelProvider.getImage()
method.
The problem appears when I load tables with large amounts of data (e.g., 8000 columns).
I instantiate the different images (only two in my case) as static properties of the View class containing the TableViewer
to avoid 8000 instances of the same image:
private static Image FAILURE_IMAGE = UIPlugin.imageDescriptorFromPlugin(
Activator.PLUGIN_ID, "/icons/failure.gif").createImage();
/** {@link Image} used to display a test case as run successfully. */
private static Image OK_IMAGE = UIPlugin.imageDescriptorFromPlugin(
Activator.PLUGIN_ID, "/icons/ok.gif").createImage();
In the ColumnLabelProvider I simply return these images:
public Image getImage(Object element) {
if (ok)
return FAILURE_IMAGE;
else
return OK_IMAGE;
}
However, I get the No More Handles error.
Do I do anything wrong? Is the code to create the Images as static fields bad or faulty? Shouldn't SWT be able to display tables with 8000 columns having icons.