}
}
}
// for Rnw we first determine the RnwWeave type
RnwWeave rnwWeave = null;
RnwWeaveDirective rnwWeaveDirective = null;
if (fileType.isRnw())
{
rnwWeaveDirective = detectRnwWeaveDirective(magicComments);
if (rnwWeaveDirective != null)
{
rnwWeave = rnwWeaveDirective.getRnwWeave();
if (rnwWeave == null)
{
// show warning and bail
display.showWarningBar(
"Unknown Rnw weave method '" + rnwWeaveDirective.getName() +
"' specified (valid types are " +
rnwWeaveRegistry_.getPrintableTypeNames() + ")");
return;
}
}
else
{
rnwWeave = rnwWeaveRegistry_.findTypeIgnoreCase(
prefs_.defaultSweaveEngine().getValue());
}
}
final SessionInfo sessionInfo = session_.getSessionInfo();
TexCapabilities texCap = sessionInfo.getTexCapabilities();
final boolean checkForTeX = fileType.canCompilePDF() &&
!texCap.isTexInstalled();
final boolean checkForRnwWeave = (rnwWeave != null) &&
!texCap.isRnwWeaveAvailable(rnwWeave);
if (checkForTeX || checkForRnwWeave)
{
// alias variables to finals
final boolean hasRnwWeaveDirective = rnwWeaveDirective != null;
final RnwWeave fRnwWeave = rnwWeave;
server_.getTexCapabilities(new ServerRequestCallback<TexCapabilities>()
{
@Override
public void onResponseReceived(TexCapabilities response)
{
if (checkForTeX && !response.isTexInstalled())
{
String warning;
if (Desktop.isDesktop())
warning = "No TeX installation detected. Please install " +
"TeX before compiling.";
else
warning = "This server does not have TeX installed. You " +
"may not be able to compile.";
display.showWarningBar(warning);
}
else if (checkForRnwWeave &&
!response.isRnwWeaveAvailable(fRnwWeave))
{
String forContext = "";
if (hasRnwWeaveDirective)
forContext = "this file";
else if (sessionInfo.getActiveProjectFile() != null)
forContext = "Rnw files for this project";
else
forContext = "Rnw files";
display.showWarningBar(
fRnwWeave.getName() + " is configured to weave " +
forContext + " " + "however the " +
fRnwWeave.getPackageName() + " package is not installed.");
}
else
{
display.hideWarningBar();
}