author | wenzelm |
Tue, 08 Dec 2009 16:30:20 +0100 | |
changeset 34760 | dc7f5e0d9d27 |
parent 34759 | src/Tools/jEdit/src/jedit/browse_version_dockable.scala@bfea7839d9e1 |
child 34777 | 91d6089cef88 |
permissions | -rw-r--r-- |
34652 | 1 |
/* |
34760 | 2 |
* Dockable window for navigating through the document history |
34652 | 3 |
* |
4 |
* @author Fabian Immler, TU Munich |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle.jedit |
|
8 |
||
34760 | 9 |
|
34660 | 10 |
import isabelle.proofdocument.Change |
34652 | 11 |
|
12 |
import java.awt.Dimension |
|
13 |
import scala.swing.{ListView, FlowPanel} |
|
14 |
import scala.swing.event.ListSelectionChanged |
|
15 |
||
16 |
import org.gjt.sp.jedit.View |
|
17 |
import org.gjt.sp.jedit.gui.DockableWindowManager |
|
18 |
||
19 |
||
34760 | 20 |
class History_Dockable(view: View, position: String) extends FlowPanel |
34686 | 21 |
{ |
34652 | 22 |
if (position == DockableWindowManager.FLOATING) |
23 |
preferredSize = new Dimension(500, 250) |
|
24 |
||
34760 | 25 |
def prover_setup(): Option[Prover_Setup] = Isabelle.prover_setup(view.getBuffer) |
34724
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
26 |
def get_versions() = |
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
27 |
prover_setup() match { |
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
28 |
case None => Nil |
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
29 |
case Some(setup) => setup.theory_view.changes |
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
30 |
} |
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
31 |
|
34660 | 32 |
val list = new ListView[Change] |
34652 | 33 |
list.fixedCellWidth = 500 |
34686 | 34 |
list.listData = get_versions() |
35 |
contents += list |
|
34652 | 36 |
|
37 |
listenTo(list.selection) |
|
38 |
reactions += { |
|
39 |
case ListSelectionChanged(source, range, false) => |
|
34760 | 40 |
prover_setup().map(_.theory_view.set_version(list.listData(range.start))) |
41 |
} |
|
34686 | 42 |
|
34724
b1079c3ba1da
Prover: keep command_change/document_change event buses here, not in ProofDocument, Command, State, Plugin;
wenzelm
parents:
34686
diff
changeset
|
43 |
prover_setup.foreach(_.prover.document_change += (_ => list.listData = get_versions())) |
34652 | 44 |
} |