use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class VuzeMessageBox method waitUntilClosed.
/* (non-Javadoc)
* @see UIFunctionsUserPrompter#waitUntilClosed()
*/
@Override
public int waitUntilClosed() {
if (opened) {
final AESemaphore sem = new AESemaphore("waitUntilClosed");
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (dlg == null) {
sem.release();
return;
}
if (!opened) {
dlg.open();
}
Shell shell = dlg.getShell();
if (shell == null || shell.isDisposed()) {
sem.release();
return;
}
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
sem.release();
}
});
}
});
if (Utils.isThisThreadSWT()) {
// on swt thread, so execSWTThread just ran and we should have a shell
if (dlg != null) {
Shell shell = dlg.getShell();
if (shell != null) {
Display d = shell.getDisplay();
while (!shell.isDisposed()) {
if (!d.readAndDispatch()) {
d.sleep();
}
}
}
skinDialogClosed(dlg);
return buttonsArea.getButtonVal(result);
}
}
sem.reserve();
}
skinDialogClosed(dlg);
return buttonsArea.getButtonVal(result);
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class TransferStatsView method initialize.
private void initialize(Composite composite) {
mainPanel = new Composite(composite, SWT.NULL);
GridLayout mainLayout = new GridLayout();
mainPanel.setLayout(mainLayout);
CoreFactory.addCoreRunningListener(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (mainPanel == null || mainPanel.isDisposed()) {
return;
}
createGeneralPanel();
createConnectionPanel();
createCapacityPanel();
createAutoSpeedPanel();
initialised = true;
}
});
}
});
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class StandardButtonsArea method setButtonEnabled.
public void setButtonEnabled(final int buttonVal, final boolean enable) {
buttonsEnabled.put(buttonVal, enable);
if (buttons == null) {
return;
}
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (buttons == null) {
return;
}
int pos = getButtonPosFromVal(buttonVal);
if (pos >= 0 && pos < buttons.length) {
Button button = buttons[pos];
if (button != null && !button.isDisposed()) {
button.setEnabled(enable);
}
}
}
});
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class UISWTStatusEntryImpl method created.
@Override
public void created(final MainStatusBar.CLabelPadding label) {
final Listener click_listener = new Listener() {
@Override
public void handleEvent(Event e) {
onClick();
}
};
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
label.addListener(SWT.MouseDoubleClick, click_listener);
}
}, true);
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class SWTNetworkSelection method selectNetworks.
@Override
public String[] selectNetworks(final String description, final String[] tracker_networks) {
final Display display = Utils.getDisplay();
if (display.isDisposed()) {
return (null);
}
final AESemaphore sem = new AESemaphore("NetworkClassifier");
final classifierDialog[] dialog = new classifierDialog[1];
try {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
dialog[0] = new classifierDialog(sem, display, description, tracker_networks);
}
});
} catch (Throwable e) {
Debug.printStackTrace(e);
return (null);
}
sem.reserve();
return (dialog[0].getSelection());
}
Aggregations