Search in sources :

Example 11 with SWTRunnable

use of com.biglybt.ui.swt.utils.SWTRunnable in project BiglyBT by BiglySoftware.

the class TableViewPainted method removeAllTableRows.

@Override
public void removeAllTableRows() {
    if (DEBUG_ROWCHANGE) {
        debug("RemoveAlLRows");
    }
    super.removeAllTableRows();
    synchronized (visibleRows_sync) {
        visibleRows = new LinkedHashSet<>();
    }
    setFocusedRow(null);
    totalHeight = 0;
    Utils.execSWTThread(new SWTRunnable() {

        @Override
        public void runWithDisplay(Display display) {
            if (cTable == null || cTable.isDisposed()) {
                return;
            }
            swt_fixupSize();
            swt_updateCanvasImage(false);
            if (DEBUG_ROWCHANGE) {
                debug("RemoveAllRows done");
            }
        }
    });
}
Also used : SWTRunnable(com.biglybt.ui.swt.utils.SWTRunnable)

Example 12 with SWTRunnable

use of com.biglybt.ui.swt.utils.SWTRunnable in project BiglyBT by BiglySoftware.

the class SideBarEntrySWT method close.

/* (non-Javadoc)
	 * @see BaseMdiEntry#close()
	 */
@Override
public boolean close(boolean force) {
    if (!super.close(force)) {
        return false;
    }
    // remove immediately from MDI because disposal is on a delay
    mdi.removeItem(SideBarEntrySWT.this);
    // dispose will trigger dispose listener, which removed it from BaseMDI
    Utils.execSWTThread(new SWTRunnable() {

        @Override
        public void runWithDisplay(Display display) {
            if (swtItem != null && !swtItem.isDisposed()) {
                try {
                    swtItem.setFont(null);
                    swtItem.dispose();
                } catch (Exception e) {
                    // on OSX, SWT does some misguided exceptions on disposal of TreeItem
                    // We occasionally get SWTException of "Widget is Disposed" or
                    // "Argument not valid", as well as NPEs
                    Debug.outNoStack("Warning on SidebarEntry dispose: " + e.toString(), false);
                } finally {
                    swtItem = null;
                }
            }
        }
    });
    return true;
}
Also used : SWTRunnable(com.biglybt.ui.swt.utils.SWTRunnable)

Example 13 with SWTRunnable

use of com.biglybt.ui.swt.utils.SWTRunnable in project BiglyBT by BiglySoftware.

the class TableCellSWTBase method setForeground.

private boolean setForeground(final RGB rgb) {
    Color colorFG = getForegroundSWT();
    boolean changed = colorFG == null || colorFG.isDisposed() || !colorFG.getRGB().equals(rgb);
    if (changed) {
        Utils.execSWTThread(new SWTRunnable() {

            @Override
            public void runWithDisplay(Display display) {
                setForeground(ColorCache.getColor(Display.getCurrent(), rgb));
            }
        });
    }
    return changed;
}
Also used : SWTRunnable(com.biglybt.ui.swt.utils.SWTRunnable) Display(org.eclipse.swt.widgets.Display)

Aggregations

SWTRunnable (com.biglybt.ui.swt.utils.SWTRunnable)13 DownloadManager (com.biglybt.core.download.DownloadManager)2 SWTThread (com.biglybt.ui.swt.mainwindow.SWTThread)2 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)2 Display (org.eclipse.swt.widgets.Display)2 LogEvent (com.biglybt.core.logging.LogEvent)1 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)1 MdiEntry (com.biglybt.ui.mdi.MdiEntry)1 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)1 BaseMdiEntry (com.biglybt.ui.swt.mdi.BaseMdiEntry)1 UISWTViewEventCancelledException (com.biglybt.ui.swt.pifimpl.UISWTViewEventCancelledException)1