@Override
    public String getToolTipTextForEntry(IntellicutListEntry listEntry, JComponent invoker) {

      Object listEntryData = listEntry.getData();
      if (listEntryData instanceof RecordType) {

        return "<html><body><b>Prelude Record</b></body></html>";

      } else if (listEntryData instanceof TypeConsApp) {

        TypeConsApp typeConsApp = (TypeConsApp) listEntryData;
        QualifiedName typeConsName = typeConsApp.getName();

        TypeConstructor typeCons =
            valueEditorManager.getPerspective().getTypeConstructor(typeConsName);
        return ToolTipHelpers.getEntityToolTip(
            typeCons, getNamingPolicy(), valueEditorManager.getWorkspace(), invoker);

      } else {
        throw new IllegalStateException("ParametricValueEditor: Unsupported list entry type");
      }
    }
  /**
   * Display execution results. Call this to display the results of the run when execution
   * terminates. Note: the runtime must still be available
   */
  private void displayResults() {

    int messageIcon = -1;
    String messageTitle = null;
    String errorMessage = null;

    // Set up the icon and the title
    if (error == null) {
      messageIcon = JOptionPane.INFORMATION_MESSAGE;
      messageTitle = GemCutter.getResourceString("GemResults");
      errorMessage = null;
    } else {
      errorMessage = error.getMessage();
      CALExecutorException.Type resultStatus = error.getExceptionType();
      if (resultStatus == CALExecutorException.Type.PRIM_THROW_FUNCTION_CALLED) {
        messageIcon = JOptionPane.ERROR_MESSAGE;
        messageTitle = GemCutter.getResourceString("GemError");

      } else if (resultStatus
          == CALExecutorException.Type.FOREIGN_OR_PRIMITIVE_FUNCTION_EXCEPTION) {
        messageIcon = JOptionPane.ERROR_MESSAGE;
        messageTitle = GemCutter.getResourceString("ForeignFunctionError");

      } else if (resultStatus == CALExecutorException.Type.ERROR_FUNCTION_CALL) {
        messageIcon = JOptionPane.ERROR_MESSAGE;
        messageTitle = GemCutter.getResourceString("GemError");

      } else if (resultStatus == CALExecutorException.Type.PATTERN_MATCH_FAILURE) {
        messageIcon = JOptionPane.ERROR_MESSAGE;
        messageTitle = GemCutter.getResourceString("PatternMatchFailure");

      } else if (resultStatus == CALExecutorException.Type.INTERNAL_RUNTIME_ERROR) {
        messageIcon = JOptionPane.ERROR_MESSAGE;
        messageTitle = GemCutter.getResourceString("RuntimeError");

      } else if (resultStatus == CALExecutorException.Type.USER_TERMINATED) {
        messageIcon = JOptionPane.INFORMATION_MESSAGE;
        messageTitle = GemCutter.getResourceString("GemResults");
      } else {
        throw new IllegalStateException("Unrecognized execution result status: " + resultStatus);
      }
    }

    if (executionResult != null) {
      try {
        executionResult.toString();
      } catch (Exception e) {
        executionResult = null;
        if (errorMessage == null) {
          errorMessage = "Error trying to display result value.";
        }
      }
    }

    // If we're not in debug output mode, and there's no scary weirdness, then we use the
    // 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);

    } else {
      // The main return is the 0th output value
      String message =
          (executionResult != null)
              ? executionResult.toString()
              : GemCutter.getResourceString("NoResults");

      // Display the output, debug style.
      JOptionPane.showMessageDialog(gemCutter, message, messageTitle, messageIcon);
    }
  }