src/Tools/jEdit/src/protocol_dockable.scala
author wenzelm
Fri, 01 Sep 2017 15:15:29 +0200
changeset 66591 6efa351190d0
parent 66206 2d2082db735a
child 72135 f67e83608745
permissions -rw-r--r--
more robust: provide docking framework via base plugin;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43282
5d294220ca43 moved sources -- eliminated Netbeans artifact of jedit package directory;
wenzelm
parents: 39588
diff changeset
     1
/*  Title:      Tools/jEdit/src/protocol_dockable.scala
36760
b82a698ef6c9 tuned headers;
wenzelm
parents: 36015
diff changeset
     2
    Author:     Makarius
b82a698ef6c9 tuned headers;
wenzelm
parents: 36015
diff changeset
     3
37067
31093f3687b5 simplified dockables using class Dockable;
wenzelm
parents: 37065
diff changeset
     4
Dockable window for protocol messages.
36760
b82a698ef6c9 tuned headers;
wenzelm
parents: 36015
diff changeset
     5
*/
34408
ad7b6c4813c8 added some headers and comments;
wenzelm
parents: 34406
diff changeset
     6
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     7
package isabelle.jedit
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     8
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
     9
36015
6111de7c916a adapted to Scala 2.8.0 Beta 1;
wenzelm
parents: 34791
diff changeset
    10
import isabelle._
66591
6efa351190d0 more robust: provide docking framework via base plugin;
wenzelm
parents: 66206
diff changeset
    11
import isabelle.jedit_base.Dockable
36015
6111de7c916a adapted to Scala 2.8.0 Beta 1;
wenzelm
parents: 34791
diff changeset
    12
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    13
import java.awt.BorderLayout
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    14
37067
31093f3687b5 simplified dockables using class Dockable;
wenzelm
parents: 37065
diff changeset
    15
import scala.swing.{TextArea, ScrollPane}
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    16
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    17
import org.gjt.sp.jedit.View
34424
c880492754d0 setPreferredSize for floating dockables;
wenzelm
parents: 34408
diff changeset
    18
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    19
37067
31093f3687b5 simplified dockables using class Dockable;
wenzelm
parents: 37065
diff changeset
    20
class Protocol_Dockable(view: View, position: String) extends Dockable(view, position)
34760
dc7f5e0d9d27 misc modernization of names;
wenzelm
parents: 34759
diff changeset
    21
{
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    22
  /* controls */
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    23
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    24
  private val ml_stats = new Isabelle.ML_Stats
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    25
66206
2d2082db735a clarified defaults;
wenzelm
parents: 66205
diff changeset
    26
  private val controls = Wrap_Panel(List(ml_stats))
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    27
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    28
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    29
  /* text area */
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    30
37067
31093f3687b5 simplified dockables using class Dockable;
wenzelm
parents: 37065
diff changeset
    31
  private val text_area = new TextArea
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    32
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    33
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    34
  /* layout */
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    35
37067
31093f3687b5 simplified dockables using class Dockable;
wenzelm
parents: 37065
diff changeset
    36
  set_content(new ScrollPane(text_area))
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    37
  add(controls.peer, BorderLayout.NORTH)
34772
1a79c9b9af82 proper actor wiring for raw process output;
wenzelm
parents: 34760
diff changeset
    38
1a79c9b9af82 proper actor wiring for raw process output;
wenzelm
parents: 34760
diff changeset
    39
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56391
diff changeset
    40
  /* main */
34671
d179fcb04cbc output_info specific to prover
immler@in.tum.de
parents: 34424
diff changeset
    41
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56391
diff changeset
    42
  private val main =
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    43
    Session.Consumer[Any](getClass.getName) {
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56391
diff changeset
    44
      case input: Prover.Input =>
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 56715
diff changeset
    45
        GUI_Thread.later { text_area.append(input.toString + "\n\n") }
43721
fad8634cee62 echo prover input via raw_messages, for improved protocol tracing;
wenzelm
parents: 43520
diff changeset
    46
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56391
diff changeset
    47
      case output: Prover.Output =>
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 56715
diff changeset
    48
        GUI_Thread.later { text_area.append(output.message.toString + "\n\n") }
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    49
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    50
      case _: Session.Global_Options =>
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    51
        GUI_Thread.later { ml_stats.load() }
34772
1a79c9b9af82 proper actor wiring for raw process output;
wenzelm
parents: 34760
diff changeset
    52
    }
1a79c9b9af82 proper actor wiring for raw process output;
wenzelm
parents: 34760
diff changeset
    53
60074
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    54
  override def init()
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    55
  {
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    56
    PIDE.session.all_messages += main
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    57
    PIDE.session.global_options += main
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    58
  }
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    59
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    60
  override def exit()
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    61
  {
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    62
    PIDE.session.all_messages -= main
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    63
    PIDE.session.global_options -= main
38a64cc17403 GUI controls for ML_statistics, for more digestible protocol dump;
wenzelm
parents: 57612
diff changeset
    64
  }
34318
c13e168a8ae6 original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff changeset
    65
}