use of org.knime.workbench.core.util.ThreadsafeImageRegistry in project knime-core by knime.
the class KNIMECorePlugin method createImageRegistry.
/**
* {@inheritDoc}
*/
@Override
protected ImageRegistry createImageRegistry() {
// If we are in the UI Thread use that
if (Display.getCurrent() != null) {
return new ThreadsafeImageRegistry(Display.getCurrent());
} else {
Display display;
if (PlatformUI.isWorkbenchRunning()) {
display = PlatformUI.getWorkbench().getDisplay();
} else {
display = Display.getDefault();
}
final AtomicReference<ImageRegistry> ref = new AtomicReference<>();
display.syncExec(new Runnable() {
@Override
public void run() {
ref.set(new ThreadsafeImageRegistry(Display.getCurrent()));
}
});
return ref.get();
}
}
Aggregations