use of apet.preferences.ApetPreferences in project abstools by abstools.
the class apetHandler method execute.
/**
* the command has been executed, so extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
final Shell shellEclipse = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
ApetShellCommand shell = new ApetShellCommand();
try {
ConsoleHandler.defaultConsole = ConsoleHandler.findCostabsConsole();
String absFile = SourceUtils.extractResource(SourceUtils.obtainActiveEditor()).getLocation().toString();
// Creating the costabs tmp directory
File f = new File("//tmp//costabs//absPL");
f.mkdirs();
if (CostabsLink.ENTRIES_STRINGS.size() <= 0) {
Status status = new Status(IStatus.ERROR, "costabs", 0, "At least one function or method must be selected in the outline view.", null);
ErrorDialog.openError(shellEclipse, "aPET Error", "aPET cannot be run.", status);
} else {
/*OptionsDialog mDialog = new OptionsDialog (shellEclipse);
mDialog.open();
if (mDialog.getReturnCode() == OptionsDialog.CANCEL) {
ConsoleHandler.write("Don't do anything, cancelled by the user");*/
IPreferencePage page = new ApetPreferences();
PreferenceManager mgr = new PreferenceManager();
IPreferenceNode node = new PreferenceNode("1", page);
mgr.addToRoot(node);
PreferenceDialog dialog = new PreferenceDialog(shellEclipse, mgr);
dialog.create();
dialog.setMessage("aPET preferences");
dialog.open();
if (dialog.getReturnCode() == PreferenceDialog.CANCEL) {
return null;
} else {
callPrologBackend(absFile);
shell.callAPet(CostabsLink.ENTRIES_STRINGS);
printError(shell);
ApetTestSuite suite = callXMLParser();
if (translate) {
Model m = getABSModel(absFile);
generateABSUnitTests(m, suite, new File(new File(absFile).getParentFile(), absUnitOutputFile));
}
}
ConsoleHandler.write(shell.getResult());
}
} catch (Exception e) {
ConsoleHandler.write(shell.getError());
e.printStackTrace(new PrintStream(ConsoleHandler.getDefault().newMessageStream()));
}
return null;
}
Aggregations