public void clear() { final ImageRegistry imageRegistry = super.getImageRegistry(); Plugins.useConfigElements( IMAGE_ID, new ICallback<IConfigurationElement>() { @Override public void process(IConfigurationElement t) throws Exception { String key = t.getAttribute("editKey"); Images.removeImage(imageRegistry, key); } }, ICallback.Utils.sysErrCallback()); registeredExtraImages = false; }
public ImageRegistry getImageRegistry(final Display display) { final ImageRegistry result = super.getImageRegistry(); if (!registeredExtraImages) { Plugins.useConfigElements( IMAGE_ID, new ICallback<IConfigurationElement>() { @Override public void process(IConfigurationElement t) throws Exception { Class<IImageRegister> clazz = Plugins.classFrom(t); IImageRegister register = clazz.newInstance(); register.registerWith(display, result); } }, ICallback.Utils.sysErrCallback()); registeredExtraImages = true; } return result; }
public IResourceGetter getResourceGetter() { if (resourceGetter == null) { resourceGetter = IResourceGetter.Utils.noResources(); Plugins.useConfigElements( BUNDLE_ID, new ICallback<IConfigurationElement>() { @Override public void process(IConfigurationElement t) throws Exception { Class<? extends Object> anchorClass = t.createExecutableExtension("class").getClass(); String name = t.getAttribute("name"); if (name == null) throw new RuntimeException( MessageFormat.format(DisplayCoreConstants.nameMissing, anchorClass)); resourceGetter = resourceGetter.with(anchorClass, name); } }, ICallback.Utils.sysErrCallback()); } return resourceGetter; }