src/Tools/jEdit/src/jedit/results_dockable.scala
author wenzelm
Tue Dec 08 20:14:08 2009 +0100 (2009-12-08)
changeset 34765 63ba7f0931e2
parent 34760 dc7f5e0d9d27
child 34768 d8d321af1478
permissions -rw-r--r--
generic HTML_Panel -- specific Results_Dockable;
wenzelm@34408
     1
/*
wenzelm@34765
     2
 * Dockable window with result message output
wenzelm@34408
     3
 *
wenzelm@34765
     4
 * @author Makarius
wenzelm@34408
     5
 */
wenzelm@34408
     6
wenzelm@34318
     7
package isabelle.jedit
wenzelm@34318
     8
wenzelm@34760
     9
wenzelm@34765
    10
import isabelle.proofdocument.HTML_Panel
wenzelm@34318
    11
wenzelm@34765
    12
import scala.io.Source
wenzelm@34760
    13
import scala.swing.{BorderPanel, Component}
wenzelm@34760
    14
wenzelm@34765
    15
import java.awt.Dimension
wenzelm@34748
    16
wenzelm@34318
    17
import org.gjt.sp.jedit.View
wenzelm@34424
    18
import org.gjt.sp.jedit.gui.DockableWindowManager
wenzelm@34745
    19
wenzelm@34318
    20
wenzelm@34765
    21
wenzelm@34765
    22
class Results_Dockable(view: View, position: String) extends BorderPanel
wenzelm@34760
    23
{
wenzelm@34428
    24
  // outer panel
wenzelm@34760
    25
wenzelm@34424
    26
  if (position == DockableWindowManager.FLOATING)
wenzelm@34760
    27
    preferredSize = new Dimension(500, 250)
immler@34406
    28
wenzelm@34748
    29
wenzelm@34745
    30
  // HTML panel
wenzelm@34745
    31
wenzelm@34765
    32
  val html_panel = new HTML_Panel(Isabelle.system, Isabelle.Int_Property("font-size"))
wenzelm@34765
    33
  add(Component.wrap(html_panel), BorderPanel.Position.Center)
wenzelm@34428
    34
immler@34669
    35
  Isabelle.plugin.state_update += (cmd => {
immler@34669
    36
    val theory_view = Isabelle.prover_setup(view.getBuffer).get.theory_view
wenzelm@34765
    37
    val body =
wenzelm@34765
    38
      if (cmd == null) Nil  // FIXME ??
wenzelm@34765
    39
      else cmd.results(theory_view.current_document)
wenzelm@34765
    40
    html_panel.render(body)
immler@34669
    41
  })
wenzelm@34318
    42
}