Description
small note -> org.jboss.tools.common.model.icons.impl.XStudioIcons:
public Image getImage(XModelObject obj) { <---------------- this function create Image and does not dispose it - so real name should sounds like createImage(...) String s = obj.getAttributeValue("image"); //$NON-NLS-1$ byte[] b = decode(s); if(b != null) { try { ByteArrayInputStream is = new ByteArrayInputStream(b); ImageData id = new ImageData(is); Image i = new Image(null, id); <---- create image here return i; } catch (SWTException e) { ModelPlugin.getPluginLog().logError(e); } catch (SWTError e) { ModelPlugin.getPluginLog().logError(e); } } return obj.getModelEntity().getMetaModel().getIconList().getImage("default.unknown"); //$NON-NLS-1$ }
org.jboss.tools.common.model.icons.impl.XModelObjectIcon
private static Hashtable<String,Image> cacheEclipse = new Hashtable<String,Image>();
all images which XStudioIcons creates --> in cacheEclipse.
but what is happens if you reload org.jboss.tools.common.model plugin? I do not sure, but look like you'll get resource leak here.
may be a better choise is to use AbstractUIPlugin.getImageRegistry(), i.e. ModelPlugin.getDefault().getImageRegistry()