public static void _open(final boolean showNoLoad, final String sourceRef) {
if (shell != null && !shell.isDisposed()) {
return;
}
final Shell parentShell = Utils.findAnyShell();
shell = ShellFactory.createShell(parentShell, SWT.BORDER
| SWT.APPLICATION_MODAL | SWT.TITLE);
shell.setLayout(new FillLayout());
if (parentShell != null) {
parentShell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
}
shell.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_ESCAPE) {
e.doit = false;
}
}
});
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
e.doit = false;
}
});
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (parentShell != null) {
parentShell.setCursor(e.display.getSystemCursor(SWT.CURSOR_ARROW));
}
if (browserFunction != null && !browserFunction.isDisposed()) {
browserFunction.dispose();
}
shell = null;
}
});
browser = Utils.createSafeBrowser(shell, SWT.NONE);
if (browser == null) {
shell.dispose();
return;
}
browser.addTitleListener(new TitleListener() {
public void changed(TitleEvent event) {
if (shell == null || shell.isDisposed()) {
return;
}
shell.setText(event.title);
}
});
browserFunction = new BrowserFunction(browser, "sendDonationEvent") {
public Object function(Object[] arguments) {
if (shell == null || shell.isDisposed()) {
return null;
}
if (arguments == null) {
Debug.out("Invalid sendDonationEvent null ");
return null;
}
if (arguments.length < 1) {
Debug.out("Invalid sendDonationEvent length " + arguments.length + " not 1");
return null;
}
if (!(arguments[0] instanceof String)) {
Debug.out("Invalid sendDonationEvent "
+ (arguments[0] == null ? "NULL"
: arguments.getClass().getSimpleName()) + " not String");
return null;
}
String text = (String) arguments[0];
if (text.contains("page-loaded")) {
pageLoadedOk = true;
COConfigurationManager.setParameter("donations.count",
COConfigurationManager.getLongParameter("donations.count", 1) + 1);
Utils.centreWindow(shell);
if (parentShell != null) {
parentShell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));
}
shell.open();
} else if (text.contains("reset-ask-time")) {
int time = reAskEveryHours;
String[] strings = text.split(" ");