Search in sources :

Example 6 with IJobErrorHandler

use of org.csstudio.swt.widgets.util.IJobErrorHandler in project yamcs-studio by yamcs.

the class SVGSymbolImage method asyncLoadImage.

@Override
public void asyncLoadImage() {
    if (imagePath == null)
        return;
    loadingImage = true;
    loadImage(new IJobErrorHandler() {

        private int maxAttempts = 5;

        @Override
        public void handleError(Exception exception) {
            if (maxAttempts-- > 0) {
                try {
                    Thread.sleep(100);
                    loadImage(this);
                    return;
                } catch (InterruptedException e) {
                }
            }
            loadingImage = false;
            // fireSymbolImageLoaded();
            Activator.getLogger().log(Level.WARNING, "ERROR in loading SVG image " + imagePath, exception);
        }
    });
}
Also used : IJobErrorHandler(org.csstudio.swt.widgets.util.IJobErrorHandler) IOException(java.io.IOException)

Aggregations

IJobErrorHandler (org.csstudio.swt.widgets.util.IJobErrorHandler)6 IOException (java.io.IOException)5 InputStream (java.io.InputStream)2 AbstractInputStreamRunnable (org.csstudio.swt.widgets.util.AbstractInputStreamRunnable)2 Image (org.eclipse.swt.graphics.Image)2 IntrospectionException (java.beans.IntrospectionException)1 OPIColor (org.csstudio.opibuilder.util.OPIColor)1 IPath (org.eclipse.core.runtime.IPath)1 Label (org.eclipse.draw2d.Label)1