Search in sources :

Example 1 with UIUpdatableAlways

use of com.biglybt.ui.common.updater.UIUpdatableAlways in project BiglyBT by BiglySoftware.

the class UIUpdaterSWT method update.

private void update(CopyOnWriteList<UIUpdatable> updateables, boolean is_visible) {
    long start = 0;
    Map<UIUpdatable, Long> mapTimeMap = DEBUG_TIMER ? new HashMap<UIUpdatable, Long>() : null;
    Display display = Utils.getDisplay();
    if (display == null || display.isDisposed()) {
        return;
    }
    for (UIUpdatable updateable : updateables) {
        try {
            if (DEBUG_TIMER) {
                start = SystemTime.getCurrentTime();
            }
            if (updateable instanceof UIUpdatableAlways) {
                ((UIUpdatableAlways) updateable).updateUI(is_visible);
            } else {
                updateable.updateUI();
            }
            if (DEBUG_TIMER) {
                long diff = SystemTime.getCurrentTime() - start;
                if (diff > 0) {
                    mapTimeMap.put(updateable, new Long(diff));
                }
            }
        } catch (Throwable t) {
            Logger.log(new LogEvent(LOGID, "Error while trying to update UI Element " + updateable.getUpdateUIName(), t));
        }
    }
    if (DEBUG_TIMER) {
        makeDebugToolTip(mapTimeMap);
    }
}
Also used : UIUpdatable(com.biglybt.ui.common.updater.UIUpdatable) LogEvent(com.biglybt.core.logging.LogEvent) UIUpdatableAlways(com.biglybt.ui.common.updater.UIUpdatableAlways) Display(org.eclipse.swt.widgets.Display)

Aggregations

LogEvent (com.biglybt.core.logging.LogEvent)1 UIUpdatable (com.biglybt.ui.common.updater.UIUpdatable)1 UIUpdatableAlways (com.biglybt.ui.common.updater.UIUpdatableAlways)1 Display (org.eclipse.swt.widgets.Display)1