use of edu.cmu.cs.hcii.cogtool.ui.Interaction.ITraceWindow in project cogtool by cogtool.
the class ProjectController method displayTraces.
protected void displayTraces(AUndertaking task, Design design) {
if (task.isTaskGroup()) {
Iterator<AUndertaking> allSubtasks = ((TaskGroup) task).getUndertakings().iterator();
while (allSubtasks.hasNext()) {
displayTraces(allSubtasks.next(), design);
}
} else {
TaskApplication taskApp = project.getTaskApplication(task, design);
if (taskApp != null) {
StringBuilder labelText = new StringBuilder();
Iterator<CognitiveModelGenerator> modelGens = taskApp.getModelGenerators();
while (modelGens.hasNext()) {
CognitiveModelGenerator modelGen = modelGens.next();
Iterator<IPredictionAlgo> computeAlgs = taskApp.getPredictionAlgs(modelGen);
while (computeAlgs.hasNext()) {
IPredictionAlgo computeAlg = computeAlgs.next();
APredictionResult result = taskApp.getResult(modelGen, computeAlg);
int resultState = result.getResultState();
if ((result != null) && ((resultState == APredictionResult.IS_COMPUTED) || (resultState == APredictionResult.COMPUTE_FAILED))) {
labelText.delete(0, labelText.length());
labelText.append(tracesWindowLabel);
labelText.append(": ");
labelText.append(project.getName());
labelText.append(" > ");
labelText.append(design.getName());
labelText.append(" > ");
labelText.append(task.getName());
String labelStr = labelText.toString();
ITraceWindow traceWin = interaction.createTraceWindow(labelStr + (OSUtils.MACOSX ? "" : UI.WINDOW_TITLE), null, labelStr);
traceWin.appendOutputLines(result.getTraceLines());
traceWin.scrollToTop();
traceWin.appendErrorLines(result.getErrorLines());
traceWin.scrollToTop();
}
}
}
}
}
}
use of edu.cmu.cs.hcii.cogtool.ui.Interaction.ITraceWindow in project cogtool by cogtool.
the class SNIFACTCmd method computeInBackground.
public static SNIFACTExecContext computeInBackground(Project project, Design design, Interaction interaction, TaskGroup group, SNIFACTParameters parms) {
isComputing = true;
try {
SNIFACTAnalysisWorkThread workThread = new SNIFACTAnalysisWorkThread(SNIFACTPredictionAlgo.ONLY, project, design, null, interaction, group, parms);
if (SNIFACTPredictionAlgo.exportCTEModelFile != null) {
return null;
}
ITraceWindow traceWin = interaction.createTraceWindow("Computation trace", workThread, "Trace output: stdout (top) and stderr (bottom)");
workThread.setTraceWindow(traceWin);
ThreadManager.startNewThread(workThread);
return workThread.getExecContext();
} catch (IPredictionAlgo.ComputationException ex) {
throw new RcvrComputationException(ex);
} catch (IllegalStateException ex) {
throw new RcvrIllegalStateException(ex);
} catch (UnsupportedOperationException ex) {
throw new RcvrUnimplementedFnException(ex);
} catch (Exception ex) {
throw new RcvrComputationException(ex);
}
}
use of edu.cmu.cs.hcii.cogtool.ui.Interaction.ITraceWindow in project cogtool by cogtool.
the class ComputePredictionCmd method computeInBackground.
/**
* Perform the analysis in the background. Set the result when done.
*/
public static APredictionResult computeInBackground(IPredictionAlgo computeAlg, Script s, Interaction interact) {
try {
DefaultAnalysisWorkThread workThread = new DefaultAnalysisWorkThread(computeAlg, s, null, interact);
ITraceWindow traceWin = interact.createTraceWindow("Computation trace", workThread, "Trace output: stdout (top) and stderr (bottom)");
workThread.setTraceWindow(traceWin);
ThreadManager.startNewThread(workThread);
return workThread.getResultProxy();
} catch (IPredictionAlgo.ComputationException ex) {
throw new RcvrComputationException(ex);
} catch (IllegalStateException ex) {
throw new RcvrIllegalStateException(ex);
} catch (UnsupportedOperationException ex) {
throw new RcvrUnimplementedFnException(ex);
} catch (Exception ex) {
throw new RcvrComputationException(ex);
}
}
Aggregations