updateService.run();
} else {
final String sandboxMessage = "The local LaTeX service was not granted the necessary permissions, " +
"this may happen if the certificate was declined. " +
"The browser may need to be restarted in order for the certificate prompt to display.";
final ClsiLocalEngine latexEngine = ClsiLocalEngine.get("editor_advanced/");
if (latexEngine.isStarted()) {
if (Window.Navigator.isJavaEnabled()) {
StaticActionDialog ad = StaticActionDialog.get();
ad.update("Java Unavailable", "<a href=\"http://www.java.com\">Java</a> was not detected. " +
"Ensure that <a href=\"http://www.java.com\">Java</a> is installed and enabled.", new ActionDialogOption[0]);
ad.center();
return;
}
if (latexEngine.isLocked()) {
StaticActionDialog ad = StaticActionDialog.get();
ad.update("Java Sandbox Detected", sandboxMessage, new ActionDialogOption[0]);
ad.center();
}
} else {
showStatus("Initializing the local LaTeX service. Please accept the certificate when prompted.", true);
latexEngine.start(new ReadyCallback() {
@Override
public void onFailure(Throwable caught) {
clearStatus();
StaticActionDialog ad = StaticActionDialog.get();
if (caught instanceof AppletUnavailableException) {
ad.update("Java Sandbox Detected",
sandboxMessage,
new ActionDialogOption[0]);
} else {
ad.update("Local LaTeX Service Initialization Error",
"There was an error initializing the local LaTeX service.",
new ActionDialogOption[0]);
}
ad.center();
}
@Override
public void onSuccess() {
clearStatus();
settings.setClsiAsyncPath(latexEngine.getAsyncPath());
settings.setClsiServiceToken(CLSI_TOKEN);
settings.setClsiServiceUrl(latexEngine.getServicePath());
settings.setCompilerName(cmd.getCompilerName());
updateService.run();
}
});
}