final String ERROR_TITLE = "Missing Perl interpreter";
final String ERROR_MSG =
"To operate correctly, EPIC requires a Perl interpreter. " +
"Check your configuration settings (\"Window/Preferences/Perl EPIC\").";
PerlExecutor executor = new PerlExecutor();
try
{
List args = new ArrayList(1);
args.add("-v");
if (executor.execute(new File("."), args, "")
.stdout.indexOf("This is perl") != -1)
{
requirePerlCheckPassed = true;
}
else
{
Status status = new Status(
IStatus.ERROR,
getPluginId(),
IStatus.OK,
"The executable specified in EPIC Preferences " +
"does not appear to be a valid Perl interpreter.",
null);
getLog().log(status);
if (!requirePerlErrorDisplayed || interactive)
{
requirePerlErrorDisplayed = true;
showErrorDialog(ERROR_TITLE, ERROR_MSG, status);
}
requirePerlCheckPassed = false;
}
}
catch (CoreException e)
{
getLog().log(e.getStatus());
if (!requirePerlErrorDisplayed || interactive)
{
requirePerlErrorDisplayed = true;
showErrorDialog(ERROR_TITLE, ERROR_MSG, e.getStatus());
}
requirePerlCheckPassed = false;
}
finally { executor.dispose(); }
}