show tooltip/sub-expression for entity markup;
authorwenzelm
Sun, 03 Apr 2011 17:35:16 +0200
changeset 42202 f6483ed40529
parent 42201 d49ffc7a19f8
child 42203 9c9c97a5040d
show tooltip/sub-expression for entity markup;
src/Pure/General/markup.scala
src/Tools/jEdit/src/jedit/isabelle_markup.scala
--- a/src/Pure/General/markup.scala	Fri Apr 01 18:29:10 2011 +0200
+++ b/src/Pure/General/markup.scala	Sun Apr 03 17:35:16 2011 +0200
@@ -97,6 +97,19 @@
   val DEF = "def"
   val REF = "ref"
 
+  object Entity
+  {
+    def unapply(markup: Markup): Option[(String, String)] =
+      markup match {
+        case Markup(ENTITY, props @ Kind(kind)) =>
+          props match {
+            case Name(name) => Some(kind, name)
+            case _ => None
+          }
+        case _ => None
+      }
+  }
+
 
   /* position */
 
--- a/src/Tools/jEdit/src/jedit/isabelle_markup.scala	Fri Apr 01 18:29:10 2011 +0200
+++ b/src/Tools/jEdit/src/jedit/isabelle_markup.scala	Sun Apr 03 17:35:16 2011 +0200
@@ -70,7 +70,8 @@
   /* markup selectors */
 
   private val subexp_include =
-    Set(Markup.SORT, Markup.TYP, Markup.TERM, Markup.PROP, Markup.ML_TYPING, Markup.TOKEN_RANGE)
+    Set(Markup.SORT, Markup.TYP, Markup.TERM, Markup.PROP, Markup.ML_TYPING, Markup.TOKEN_RANGE,
+      Markup.ENTITY)
 
   val subexp: Markup_Tree.Select[(Text.Range, Color)] =
   {
@@ -111,6 +112,7 @@
 
   val tooltip: Markup_Tree.Select[String] =
   {
+    case Text.Info(_, XML.Elem(Markup.Entity(kind, name), _)) => kind + " " + name
     case Text.Info(_, XML.Elem(Markup(Markup.ML_TYPING, _), body)) =>
       Pretty.string_of(List(Pretty.block(XML.Text("ML:") :: Pretty.Break(1) :: body)),
         margin = Isabelle.Int_Property("tooltip-margin"))