// value entry mechanism. Else, just use the debug output.
if (!gemCutter.isDebugOutputMode()// && (numValues > 0) //&& !programmaticErrorFlagged
/*&& valueNodeBuilderHelper.isConstructorNodeArgumentStackEmpty()*/) {
// If there's an extra message, print it out.
ValueNode vn = getOutputValueNode();
if (executionResult == null) {
// If we got a null result and no error, check for the case where the null represents a null foreign value.
// foreignTypeConsApp will hold the TypeConsApp for the output value
// if the value is a foreign value and the result is null.
TypeConsApp foreignTypeConsApp = null;
if (errorMessage == null && vn != null) {
TypeConsApp typeConsApp = vn.getTypeExpr().rootTypeConsApp();
if (typeConsApp != null && typeConsApp.getForeignTypeInfo() != null) {
foreignTypeConsApp = typeConsApp;
}
}
if (foreignTypeConsApp != null) {
// Make sure that the value node is a ForeignValueNode.
// An example of a problem this prevents:
// The ColorValueNode is encapsulates a foreign Java value java.awt.Color, and so has a foreign type.
// However, the color output editor may assume that it has a non-null editor.
if (!(vn instanceof ForeignValueNode)) {
vn = new ForeignValueNode(null, foreignTypeConsApp);
}
vn.setOutputJavaValue(null);
} else {
vn = null;
}
} else {
vn.setOutputJavaValue(executionResult);
}
// Make sure target is visible before we display results
gemCutter.getTableTop().getTableTopPanel().scrollRectToVisible(targetDisplayedGem.getBounds());
gemCutter.displayOutput(vn, targetDisplayedGem, messageTitle, errorMessage);