use of com.biglybt.ui.swt.subscriptions.SubscriptionManagerUI in project BiglyBT by BiglySoftware.
the class Initializer method run.
@Override
public void run() {
DelayedTask delayed_task = UtilitiesImpl.addDelayedTask("SWT Initialisation", new Runnable() {
@Override
public void run() {
init_task.reserve();
}
});
delayed_task.queueFirst();
// initialise the SWT locale util
long startTime = SystemTime.getCurrentTime();
new LocaleUtilSWT(core);
final Display display = Utils.getDisplay();
new UIMagnetHandler(core);
if (!STARTUP_UIFIRST) {
// Ensure colors initialized
Colors.getInstance();
UIConfigDefaultsSWT.initialize();
UIConfigDefaultsSWTv3.initialize(core);
} else {
COConfigurationManager.setBooleanDefault("Show Splash", false);
}
if (COConfigurationManager.getBooleanParameter("Show Splash")) {
display.asyncExec(new AERunnable() {
@Override
public void runSupport() {
new SplashWindow(display, Initializer.this);
}
});
}
System.out.println("Locale Initializing took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
core.addLifecycleListener(new CoreLifecycleAdapter() {
@Override
public void componentCreated(Core core, CoreComponent component) {
Initializer.this.reportPercent(curPercent + 1);
if (component instanceof GlobalManager) {
reportCurrentTaskByKey("splash.initializePlugins");
InitialisationFunctions.earlyInitialisation(core);
} else if (component instanceof PluginInterface) {
PluginInterface pi = (PluginInterface) component;
String name = pi.getPluginName();
String version = pi.getPluginVersion();
// text says initializing, but it's actually initialized. close enough
String s = MessageText.getString("splash.plugin.init") + " " + name + (version == null ? "" : (" v" + version));
reportCurrentTask(s);
}
}
// @see com.biglybt.core.CoreLifecycleAdapter#started(com.biglybt.core.Core)
@Override
public void started(Core core) {
handleCoreStarted(core);
}
@Override
public void stopping(Core core) {
Alerts.stopInitiated();
}
@Override
public void stopped(Core core) {
}
@Override
public boolean syncInvokeRequired() {
return (true);
}
@Override
public boolean requiresPluginInitCompleteBeforeStartedEvent() {
return (false);
}
@Override
public boolean stopRequested(Core _core) throws CoreException {
return handleStopRestart(false);
}
@Override
public boolean restartRequested(final Core core) {
return handleStopRestart(true);
}
});
reportCurrentTaskByKey("splash.initializeCore");
boolean uiClassic = COConfigurationManager.getStringParameter("ui").equals("az2");
try {
new SearchUI();
} catch (Throwable e) {
Debug.printStackTrace(e);
}
try {
subscriptionManagerUI = new SubscriptionManagerUI();
} catch (Throwable e) {
Debug.printStackTrace(e);
}
if (!uiClassic) {
try {
deviceManagerUI = new DeviceManagerUI(core);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
if (core.canStart()) {
// Other UIs could start the core before us
if (!core.isStarted()) {
core.start();
} else {
handleCoreStarted(core);
}
reportPercent(50);
System.out.println("Core Initializing took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
reportCurrentTaskByKey("splash.initializeUIElements");
// Ensure colors initialized
Colors.getInstance();
reportPercent(curPercent + 1);
Alerts.init();
reportPercent(curPercent + 1);
ProgressWindow.register(core);
reportPercent(curPercent + 1);
new SWTNetworkSelection();
reportPercent(curPercent + 1);
new AuthenticatorWindow();
new CryptoWindow();
reportPercent(curPercent + 1);
new CertificateTrustWindow();
core.getPluginManager().getPluginInstaller().addListener(new PluginInstallerListener() {
@Override
public boolean installRequest(final String reason, final InstallablePlugin plugin) throws PluginException {
if (plugin instanceof StandardPlugin) {
Map<Integer, Object> properties = new HashMap<>();
properties.put(UpdateCheckInstance.PT_UI_EXTRA_MESSAGE, reason);
plugin.install(false, false, false, properties);
return (true);
} else {
return (false);
}
}
});
} else {
CoreWaiterSWT.startupAbandoned();
final AESemaphore sem = new AESemaphore("waiter");
Utils.execSWTThread(new Runnable() {
@Override
public void run() {
MessageBoxShell mb = new MessageBoxShell(MessageText.getString("msgbox.force.close.title"), MessageText.getString("msgbox.force.close.text", new String[] { core.getLockFile().getAbsolutePath() }), new String[] { MessageText.getString("Button.ok") }, 0);
mb.setIconResource("error");
mb.setModal(true);
mb.open(new UserPrompterResultListener() {
@Override
public void prompterClosed(int result) {
sem.releaseForever();
}
});
}
});
sem.reserve();
SESecurityManager.exitVM(1);
}
}
Aggregations