Ejemplo n.º 1
0
  /**
   * Update the tooltips. Note: we can only do this when the panel is parented, since the
   * ToolTipHelpers functions need a Graphics context to make font size calculations. A graphics
   * context is only available once a component has been parented.
   *
   * @param polymorphicVarContext used to toString() the TypeExpr of the arguments
   */
  public void refreshDisplay(PolymorphicVarContext polymorphicVarContext) {

    for (final ArgumentEditorPanel editorPanel : editorPanels) {
      editorPanel.refreshDisplay(polymorphicVarContext);
    }

    DataConstructor dataConstructor = getDataConstructor();
    titleLabel.setToolTipText(
        ToolTipHelpers.getEntityToolTip(
            dataConstructor, namingPolicy, parentEditor.valueEditorManager.getWorkspace(), this));
  }
    @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");
      }
    }