}
}
// @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#showCoreWaitDlg()
public Shell showCoreWaitDlg() {
final SkinnedDialog closeDialog = new SkinnedDialog(
"skin3_dlg_coreloading", "coreloading.body", SWT.TITLE | SWT.BORDER
| SWT.APPLICATION_MODAL);
closeDialog.setTitle(MessageText.getString("dlg.corewait.title"));
SWTSkin skin = closeDialog.getSkin();
SWTSkinObjectButton soButton = (SWTSkinObjectButton) skin.getSkinObject("close");
final SWTSkinObjectText soWaitTask = (SWTSkinObjectText) skin.getSkinObject("task");
final SWTSkinObject soWaitProgress = skin.getSkinObject("progress");
if (soWaitProgress != null) {
soWaitProgress.getControl().addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
Control c = (Control) e.widget;
Point size = c.getSize();
e.gc.setBackground(ColorCache.getColor(e.display, "#23a7df"));
Object data = soWaitProgress.getData("progress");
if (data instanceof Long) {
int waitProgress = ((Long) data).intValue();
int breakX = size.x * waitProgress / 100;
e.gc.fillRectangle(0, 0, breakX, size.y);
e.gc.setBackground(ColorCache.getColor(e.display, "#cccccc"));
e.gc.fillRectangle(breakX, 0, size.x - breakX, size.y);
}
}
});
}
if (!AzureusCoreFactory.isCoreRunning()) {
final Initializer initializer = Initializer.getLastInitializer();
if (initializer != null) {
initializer.addListener(new InitializerListener() {
public void reportPercent(final int percent) {
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
if (soWaitProgress != null && !soWaitProgress.isDisposed()) {
soWaitProgress.setData("progress", new Long(percent));
soWaitProgress.getControl().redraw();
soWaitProgress.getControl().update();
}
}
});
if (percent > 100) {
initializer.removeListener(this);
}
}
public void reportCurrentTask(String currentTask) {
if (soWaitTask != null && !soWaitTask.isDisposed()) {
soWaitTask.setText(currentTask);
}
}
});
}
}
if (soButton != null) {
soButton.addSelectionListener(new ButtonListenerAdapter() {
public void pressed(SWTSkinButtonUtility buttonUtility,
SWTSkinObject skinObject, int stateMask) {
closeDialog.close();
}
});
}
closeDialog.addCloseListener(new SkinnedDialogClosedListener() {
public void skinDialogClosed(SkinnedDialog dialog) {
}
});
closeDialog.open();
return closeDialog.getShell();
}